Re: Option Value

From: Date: Fri, 23 Feb 2007 20:19:56 +0000
Subject: Re: Option Value
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-249314@lists.php.net to get a copy of this message
On Fri, February 23, 2007 9:10 am, Dan Shirah wrote: > 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. [snip] > Any suggestions on how to make my initial display of the field blank > without > having to add a blank row to my table? Just hard-code a blank OPTION in the HTML after the SELECT, but before the PHP to dump out the other options: <SELECT NAME="whatever"> <OPTION VALUE="">-- Select Choice --</OPTION> <?php /* your posted code goes here */ ?> </SELECT> Presentation Purists will claim this is wrong, I suspect, since it hard-codes the one special value for "nothing selected" but there it is. I personally have less trouble with this method than the other half-dozen I tried over the years. YMMV IANAL NAIAA -- Some people have a "gift" link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So?

« previous php.general (#249314) next »