Re: SELECT box

From: Date: Mon, 11 Dec 2000 23:56:32 +0000
Subject: Re: SELECT box
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-29772@lists.php.net to get a copy of this message
On Tue, 12 Dec 2000, Robert Ludvik wrote: > > You should have a "key" value in the table (ideally an autoincrement field, or > > at least unique) that has the selection value. Then you display the > > description in between <option ...>...</option>. > > > well, first three places of a whole string $vrstica are unique in my table, so > i thought that i would get that as a result. see, $vrstica is > attr1.attr2...attrn where attr1 is an unique char(3) attr. if i make a > selection and hit OK button, the value of $data1 should become the right one > right? or am i missing something basic here??? > The variable name will be determined by the name attribute of the select command, and the value of the variable will be the contents of the value attribute of the selected option element. <select name="var"> <option value="1">Item One</option> <option value="2">Item Two</option> </select> If "Item One" is selected then $var will contain "1", and the same thing with "Item Two" and "2". Note that the type of $var will always be a string. -- Ignacio Vazquez-Abrams <ignacio@openservices.net>

« previous php.general (#29772) next »