Re: listbox problems
| From: | Sunfire | Date: | Sun, 02 Feb 2003 23:16:17 +0000 |
| Subject: | Re: listbox problems | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-134061@lists.php.net to get a copy of this message | ||
hi..
listbox prob fixed...
i had echo "<select name='user's<br>";
in the first file it should have been:
echo "<select name='users'<br>";
and in second file i had:
echo 'account[username]........<br>';
should have been :
echo "$account[username]......<br>";
----- Original Message -----
From: "Matt" <mschroebel@epooch.com>
To: "Sunfire" <rusty_81@msn.com>; <php-general@lists.php.net>
Sent: Sunday, February 02, 2003 4:55 PM
Subject: Re: [PHP] listbox problems
> >From: "Sunfire" <rusty_81@msn.com>
> >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
>
>
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.443 / Virus Database: 248 - Release Date: 1/10/2003