I have a page which includes numerous images generated from a MySQL table each with its own form/drop-down box. The values in the drop down box are identical in all cases and limited in number - maximum 10.
It is very easy to create a query to create the drop down box within the Select i.e.
while($Row=mysql_fetch_array($Result))
{
print ("<option value='$Row[id]'>$Row[size] - £$Row[price]</option>\n");
}
This produces for example:-
<option value='1'>6ins x 4ins - £5.50</option>
<option value='2'>8ins x 5ins - £7.50</option>
But, I don't want to repeat this query with every picture for obvious reasons.
So, how can I run the query just once on the page and load the entire output into a single string to use within each Select?
example required result:-
$optionstr="<option value='1'>6ins x 4ins - £5.50</option><option value='2'>8ins x 5ins - £7.50</option>";
I am sure there is a simple solution which is evading my simple brain!
Assistance appreciated.
Chris