User not logged in - login - register
Home Calendar Books School Tool Photo Gallery Message Boards Users Statistics Advertise Site Info
go to bottom | |
 Message Boards » » Javascript Checkbox Question Page [1]  
mytwocents
All American
20654 Posts
user info
edit post

So...if I have a form with a section that says, 'Check all that apply' how do I configure my sendmail (I'm using php) to list those that are checked? Do I have to do a seperate one for each variable?

For instance...
'hobbies: '.$hob."\n"
is how I currently have it, but I'm only getting one of the variables even if multiple are checked?

1/18/2006 1:39:20 PM

BigMan157
no u
103352 Posts
user info
edit post

i have something like this on one of the pages i've been working on

i'd have the checkboxes be like

'<input type=checkbox name=hob['.$counter.']>'

and then on submit have in a for statement
if($hob[$count]) {}

which checks what all has been marked

1/18/2006 4:49:02 PM

Stein
All American
19842 Posts
user info
edit post

form.php

<form action="handler.php" method="POST">
<input type="checkbox" name="Hobbies[]" value="Hobby 1" /> Hobby 1
<input type="checkbox" name="Hobbies[]" value="Hobby 2" /> Hobby 2
<input type="checkbox" name="Hobbies[]" value="Hobby 3" /> Hobby 3
</form>

handler.php

foreach ($_POST['Hobbies'] as $val){
echo $val;
// $val is the Hobbies that people selected
}

1/18/2006 5:28:21 PM

 Message Boards » Tech Talk » Javascript Checkbox Question Page [1]  
go to top | |
Admin Options : move topic | lock topic

© 2024 by The Wolf Web - All Rights Reserved.
The material located at this site is not endorsed, sponsored or provided by or on behalf of North Carolina State University.
Powered by CrazyWeb v2.38 - our disclaimer.