Re: drop down menu to a table
| From: | Dan Shirah | Date: | Tue, 03 Mar 2009 13:33:33 +0000 |
| Subject: | Re: drop down menu to a table | ||
| References: | 1 2 3 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-29199@lists.php.net to get a copy of this message | ||
>
> How do you specify the value of the option?
>
Or if you are working with values from a database you could do something
simple like:
<SELECT name="name">
<?php
$q_name = "SELECT * from name_table";
$r_name = ifx_query($q_name, $connect_id) or die("couldn't execute the
query");
while ($rec_name = ifx_fetch_row($r_name)) $name[] = $rec_name;
echo "<OPTION value=\"\">--SELECT--</OPTION>\n";
foreach ($name as $n)
{
if ($n['full_name'] == $_POST['name'])
echo "<OPTION value=\"{$n['full_name']}\"
SELECTED>{$n['full_name']}</OPTION>\n";
else
echo "<OPTION
value=\"{$n['full_name']}\">{$n['full_name']}</OPTION>\n";
}
?>
</SELECT>