<form method="post" action="formhandler.php"> <input type="checkbox" name="colors[]" value="red"> <input type="checkbox" name="colors[]" value="green"> <input type="checkbox" name="colors[]" value="blue"> </form>
This creates the indexed array $_POST['colors']. The array will only have as many values as were checked. In otherwords if Red and Blue are checked the values will be reutnred at $_POST['colors'][0] and $_POST['colors'][1].. not at index [0] and [2] as you might expect. Hope this helps, Kevin ----- Original Message ----- From: "Lon Lentz" <[EMAIL PROTECTED]> To: "Php-General@Lists. Php. Net" <[EMAIL PROTECTED]> Sent: Thursday, August 29, 2002 3:07 PM Subject: [PHP] How to handle multiple value checkboxes > > > If I have a form with multiple checkboxes with different values but the > same name, and someone selects a couple of them, how do I reference all of > the values? Right now I am only getting the last one selected. > > > > __________________________ > Lon Lentz > Applications Developer > EXImpact.com > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php