Re: Array form processing

From: Date: Wed, 30 Jun 2010 13:58:19 +0000
Subject: Re: Array form processing
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-306567@lists.php.net to get a copy of this message
At 4:54 PM -0400 6/29/10, Ron Piggott wrote:
I am trying to process a form where the user uses checkboxes: <input type="checkbox" name="painDesc[]" value="1" />Sharp <input type="checkbox" name="painDesc[]" value="2" />Stabbing <input type="checkbox" name="painDesc[]" value="3" />Jabbing When I do: foreach($_REQUEST as $key => $val) {
     $$key = $val;
echo $key . ": " . $val . "<br>"; } The output is: painDesc: Array I need to know the values of the array (IE to know what the user is checking), not that there is an array. I hope to save these values to the database. Thank you. Ron
Ron: Try this: http://php1.net/b/form-checkbox/ If you want the form to retain the values, try this: http://php1.net/b/form-checkbox1/ Cheers, tedd -- ------- http://sperling.com http://ancientstones.com http://earthstones.com

« previous php.general (#306567) next »