Re: PHP & MySQL pop-up
| From: | Matt McClanahan | Date: | Sun, 06 Aug 2000 21:39:47 +0000 |
| Subject: | Re: PHP & MySQL pop-up | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-1808@lists.php.net to get a copy of this message | ||
On Sun, 6 Aug 2000, Adv. Systems Design wrote:
> I am a PHP newbie and am looking for info or pointers
> on implementing the following feature:
> How to fill the elements of a popup menu with items
> queried from a table...for instance, user input is CA
> and what we want is a popup to return with all the
> zipcodes for CA.
Well, it'd work the same way any iteration of DB data would..
$con = mysql_connect($host,$user,$pass);
$res = mysql_query('SELECT Zipcode FROM Zipcodes WHERE State="CA"',$con);
echo '<select name="zipcode">' . "\n";
while( ($row = mysql_fetch_array($res)) )
echo '<option value="' . $row[Zipcode] . '"> ' .
$row[Zipcode] .
"</option>\n";
echo '</select>' . "\n";
Or something along those lines.
Matt