[PHP] RE: How to handle multiple value checkboxes

2002-08-30 Thread COQUET,JULIEN (Non-HP-France,ex1)


name your checkboxes like so

input type=checkbox name=mycheckbox[] value=1

on your result page you'll end up with an array of checked boxes. If the
boxes are not checked they dont appear in the array.
for quick and dirty debugging on your result page:

?
print 'pre';
print_r($_POST['mycheckbox']); // returns your checkbox array
print '/pre';
?

hope this helps :)

:: Julien COQUET
EMEA hp.com Common Services
Cap Gemini Ernst  Young
Advanced Delivery and Integration 



-Original Message-
From: Lon Lentz [mailto:[EMAIL PROTECTED]]
Sent: Thursday, August 29, 2002 11:07 PM
To: Php-General@Lists. Php. Net
Subject: 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] Re: How to handle multiple value checkboxes

2002-08-29 Thread Matthias Stürmer

hi lon

thats because for the same variable can be submitted only one value. make an
array (like variable[]) out of your variable and then parse it with
foreach() for working with the values selected by the user.

hope you understand what i'd like to say. my english is not too good.

bye,
matt



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php