I'm creating a data entry form where a user can submit multiple entries. Each entry uses a pulldown menu. I'm using a MySQL table to store options for a pulldown menu in each row of the form. However, I only seem to be able to use the results of the table query to populate the first pulldown menu. The subsequent pulldown menus are not populated. I've tried using the reset() command, but I get an error.
Help? I assume that a pointer is moving to the end of the query results, but I don't know how to reset it to the beginning. I really hope I don't have to run the query multiple times.
The relevant code snippets look like this:
$querycompanies = "Select * from companies";
$resultcompanies = mysql_query($querycompanies);
.....table and form header information.......
print "<OPTION value=\"\"></option>\n";
while ($row = mysql_fetch_array($resultcompanies))
{
print "<OPTION value=\"$row[id]\">$row[company]</option>\n";
}
print "<OPTION value=\"\"></option>\n";
while ($row = mysql_fetch_array($resultcompanies))
{
print "<OPTION value=\"$row[id]\">$row[company]</option>\n";
}
........table and form closing information.........
In this example, the first pulldown is populated, and the second one isn't.
I've done numerous Google and PHPBuilder searches, and I've looked through the PHP books I have, but I can't find what I'm looking for.
Thanks!
Mark