Re: Option Value
| From: | Németh Zoltán | Date: | Fri, 23 Feb 2007 15:22:04 +0000 |
| Subject: | Re: Option Value | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-249292@lists.php.net to get a copy of this message | ||
2007. 02. 23, péntek keltezéssel 10.10-kor Dan Shirah ezt írta:
> On my form I have several drop down menus. They all work and display the
> corrent values. However, I would like the initial display of the form to
> show each dropdown as blank.
>
>
> $q_status = "SELECT * FROM status_codes ORDER BY status_description";
> $r_status = mssql_query($q_status) or die(mssql_error());
> while ($rec_status = mssql_fetch_assoc($r_status)) $status[] =
> $rec_status;
>
> foreach ($status as $s)
> {
> if ($s['status_code'] == $_POST['status'])
> echo "<OPTION value=\"{$s['status_code']}\"
> SELECTED>{$s['status_description']}</OPTION>\n";
> else
> echo "<OPTION
>
> value=\"{$s['status_code']}\">{$s['status_description']}</OPTION>\n";
> }
>
> Any suggestions on how to make my initial display of the field blank without
> having to add a blank row to my table?
echo a blank <option> before the others
greets
Zoltán Németh