|
Posted by fetchpiyush on 11/18/34 11:43
Hi, I am pretty new to php and have to implement this functionality to
select a user from a list box. I have written the code for this, but
the problem is after selecting a name and doing the required task, it
again selects the first entry in the list box. So if there are 100
users, the 100th one has to scroll down again and again.
I need to modify this code so that until the session expires, if a
person has selected his name once, that name will be selected in the
listbox until he changes it.
<select name="name" style="width: 120px;">
<?php
$query = sprintf("select * from person order by person_name");
$result = mysql_query($query);
$i = 0;
while($row = mysql_fetch_array($result))
{
$i++;
printf("<option
value=\"$row[person_num]\">$row[person_name]</option>");
}
?>
</select>
Regards,
Piyush
[Back to original message]
|