Re: PHP and listbox multiple selections

From: Date: Thu, 31 Jan 2002 20:24:49 +0000
Subject: Re: PHP and listbox multiple selections
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-82987@lists.php.net to get a copy of this message
On Monday, January 28, 2002, at 10:41 AM, Simos Varelakis wrote:
A php form contains a listbox (named foolist) with n Items which can be multiple selected and form posted to results.php how can results.php determine which items were selected in order to add all the items in a Mysql table ???
You can define each <option> in a listbox with an array element as its value. Like so: <select name="listbox"> <option value="var[0]">Item 1</option> <option value="var[1]">Item 2</option> <option value="var[2]">Item 3</option> </select> That's one way to do it. Personally, if I'm populating a listbox with results returned from a SQL query, I use the primary key of the record as the "value" attribute in <option>. Erik ---- Erik Price Web Developer Temp Media Lab, H.H. Brown pricee@hhbrown.com

« previous php.general (#82987) next »