Re: Is there an easier way of doing this?

From: Date: Wed, 10 May 2006 08:59:52 +0000
Subject: Re: Is there an easier way of doing this?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-235862@lists.php.net to get a copy of this message
Chris Grigor wrote:
morning all, Is there an easier way of doing the following?? form1 submitting to form1.php <input type="checkbox" name="1"> <input type="checkbox" name="2"> <input type="submit>
make this into: <input type="checkbox" name="blah[1]" value="1"> <input type="checkbox" name="blah[2]" value="1"> then you can: foreach($_POST['blah'] as $p => $x) { if (!isset($_POST['blah'][$p])) { echo "item $p was not selected"; } else { echo "item $p was selected"; } } -- Postgresql & php tutorials http://www.designmagick.com/

« previous php.general (#235862) next »