H:
I am using a MySQL query to build options in a select box in a form.
Like so:
while ($Row = mysql_fetch_array ($roomResult))
{
//fill the select box elements
echo "<option value=\"$Row[ROOM]\">$Row[ROOM] ($Row[STCOUNT] students)</option>";
}
I want to add one more element that gives a wildcard value (all rooms) and includes the total number of students. Like so:
while ($Row = mysql_fetch_array ($ALLroomsResult))
{
//fill the select box elements
ECHO "<option value=\"ALL\">All Gr.$GRADE rooms ($Row[STCOUNT] students)</option>";
}
This all works fine, but I'd like to use the same select box on a second form on the same page for a different purpose. I thought if I could store the options as a $HASH string type variable, that would be quicker than having the script run the same queries twice. But I don't quite get how to code the part where the "echo" statements all get compiled into a single $HASH string.
Thanks for any suggestions.