Hi
You'll have to excuse me. I haven't used PHP for over a year and am very rusty in deed. Basically, I'm pulling a query from a database and storing it in an array. I want to use that array to populate a form dropdown list. No problems with this, but i want to use the same dropdown list multiple times on the page, yet it only seems to populate the first dropdown list on the page and the rest are blank. What am I doing wrong? Here is my code:
<?
//Open connection to database to populate dropdown user IDs
$db = mysql_connect("localhost","XX","XX");
mysql_select_db("list",$db);
//Run query to select users from the database
$query = mysql_query("SELECT ID FROM table order BY ID ASC")or die(mysql_error());
?>
<select name="name">
<option value="0"></option>
<?
//begin to populate dropdown list of users
while($result = mysql_fetch_array($query))
{ echo "<option>".$result['ID']."</option>";
}
//THIS POPULATES FINE. BUT LETS SAY I DO IT AGAIN
?>
</select>
<select name="name2">
<option value="0"></option>
<?
//begin to populate dropdown list of users
while($result = mysql_fetch_array($query))
{ echo "<option>".$result['ID']."</option>";
}
//THIS ONE IS EMPTY
?>
</select>
<?
//close database connection
mysql_close($db);
?>
Thanks for any help you can give me.
Ant