Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
- selection from a list box.
March 28, 2006, 2:58 pm
rate this thread
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;">
$query = sprintf("select * from person order by person_name");
$result = mysql_query($query);
$i = 0;
while($row = mysql_fetch_array($result))
Re: selection from a list box.
When the selected name is being processed:
session_start(); // send session_id cookie to user
$_SESSION['username'] = $uname;
At the top of any file that needs to know:
In the selection box:
echo '<SELECT NAME="....>';
if ($thisname==$uname) echo 'SELECTED';