>From: "Sunfire" <[EMAIL PROTECTED]> >Sent: Sunday, February 02, 2003 4:53 PM >Subject: [PHP] listbox problems
> i have a listbox: > <select name="users"> > <?php > //connect to db and get query > mysql_connect("....."); > mysql_select_db("..."); > $query=mysql_query("select username from users); > /*finish the listbox*/ > while($account=mysql_fetch_array($query)){ > echo "<option value=$account[username]>$account[username]<br>"; Try: echo "<option value={$account['username']}"; $selected = ($account['username'] == $_POST['user']) ? 'selected' : ''; echo $selected; echo ">{$account['username']}<br>"; > } > ?> > </select> > <input type="submit" value="send"> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php