RE: [PHP] PHP Coding Question

From: Date: Thu, 26 Oct 2000 02:31:34 +0000
Subject: RE: [PHP] PHP Coding Question
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-22014@lists.php.net to get a copy of this message
Hi Kyle, Easier than you think bud, PHP teat any submitted form elemnt name as veriable name in the recieb ok in your form name your check boxes like an array with empty square brackets e.g. <form action="script.php" method="get"> fee<input type="checkbox" name="check[]" value="fee"> fi<input type="checkbox" name="check[]" value="fi"> fo<input type="checkbox" name="check[]" value="fo"> fum<input type="checkbox" name="check[]" value="fum"> <input type="submit" value="Submit"> </form> submit in the form on the .php script your sedningt he form data to do something like this <? $array_count = count($check); for($=0;$i<$array_count;$i++){ print $check[$i]; } ?> very raw I know but you should get the idea note only those checked will get submitted so there is no need to worry about checking for empties I was surprised how easy it was Cheers Steven ps if I have made any mistakes please let me know but this method certainly worked for me ******************************* Steven Michael Holloway Web Programmer Port Douglas Internet Services Cairns Australia steven@pdis.com.au ******************************* -----Original Message----- From: Kyle Mathews [mailto:kyle@thedip.net] Sent: Thursday, October 26, 2000 8:21 AM To: php-general@lists.php.net Subject: [PHP] PHP Coding Question Ok, this is what I'm trying to do. Setup a form with about 20 different check boxes. Now once submitted I need the values of the boxes that were checked to go into an array. I need this so that I can later dump the values, in a clean manner, to a printable page. Is there an efficient way to do this, and if so could someone give me some example code? Thanks, Kyle -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net For additional commands, e-mail: php-general-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.general (#22014) next »