RE: [PHP] multiple selects and $_POST['vars']

From: Date: Thu, 06 Jun 2002 17:17:57 +0000
Subject: RE: [PHP] multiple selects and $_POST['vars']
Groups: php.general 
Request: Send a blank email to php-general+get-100963@lists.php.net to get a copy of this message
Or you can added the bleh as an array... example: <select multiple name="bleh[]"> Thank you, RAY HUNTER -----Original Message----- From: Chris Knipe [mailto:savage@savage.za.org] Sent: Thursday, June 06, 2002 5:56 AM To: php-general@lists.php.net Subject: [PHP] multiple selects and $_POST['vars'] Lo all, How do you manage multiple selects and the data returned by the form? All my attempts at doing this, only returned one variable from the selected options, not all of them?? My test... <form method="post" action="blah.php"> <select multiple name="bleh"> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="5">5</option> </select> </form> blah.php: echo $_POST['bleh']; $_POST['bleh'] would only have the value of the last selected option in the form... I've tried array_count_values as well to maybe see if PHP didn't save the multiple selected items into a array, but it only reported back that $_POST['bleh'] isn't a array..... So, if I select all 5 items in the above form, why does PHP only return the last option I selected, and how do I get it to return all the selected values? Additionally, if ($_POST['bleh'] == "") { always fails.... Regardless if 1, 2, 3 or even all 5 of the options in the form is selected (highlighted).... Which, is *really* strange, seeing that echo $_POST['bleh'] returns 1 out of the 5 selected values. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

« previous php.general (#100963) next »