RE: [PHP] <select name=....
| From: | PHPBeginner.com | Date: | Sat, 24 Feb 2001 06:16:31 +0000 |
| Subject: | RE: [PHP] <select name=.... | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-41453@lists.php.net to get a copy of this message | ||
No it will give you the same value twice...
you need a loop
<SELECT NAME="state" SIZE="1">
<OPTION VALUE="Canberra">ACT</OPTION>
<OPTION VALUE="Victoria">VIC</OPTION>
looping the rows .,...{
echo "<OPTION
VALUE=\"".$row['state']."\">".$row['state_abbr']."</OPTION>
";
}
</SELECT>
Sincerely,
Maxim Maletsky
Founder, Chief Developer
PHPBeginner.com (Where PHP Begins)
maxim@phpbeginner.com
www.phpbeginner.com
-----Original Message-----
From: Peter Houchin [mailto:peterh@vfsa.com.au]
Sent: Friday, February 23, 2001 1:17 PM
To: PHP MAIL GROUP
Subject: [PHP] <select name=....
if i have a form with a select box in it how an i get the values to echo a
php value ...
ie
<SELECT NAME="state" SIZE="1">
<OPTION VALUE="Canberra">ACT</OPTION>
<OPTION VALUE="Victoria">VIC</OPTION>
</SELECT>
can i change it to say
<SELECT NAME="state" SIZE="1">
<OPTION VALUE="<? echo $state ?>">ACT</OPTION>
<OPTION VALUE="<?echo $state ?>">VIC</OPTION>
</SELECT>
so that when the page loads it shows which ever option is in the Data base?
Peter Houchin
Sun Rentals
peterh@sunrentals.com.au