Welcome to WebmasterWorld Guest from 54.160.177.33

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

html form checkbox: array?

how do I know what boxes have been checked

     
9:24 pm on Mar 3, 2006 (gmt 0)

New User

10+ Year Member

joined:Nov 16, 2004
posts:3
votes: 0


Hi
I have created an html form which contains one question with checkboxes. I'd like the users to check off all of the items they have in their location, and submit the form which goes to my email.
Here's a snippet:

My library provides the following Assistive Technology devices: <BR>
<INPUT type="checkbox" name="assistivetech[]" value="Reading Magnifier">Reading Magnifier<BR>
<INPUT type="checkbox" name="assistivetech[]" value="Interpretype">Interpretype<BR>
<INPUT type="checkbox" name="assistivetech[]" value="Large Print Internet Monitor">Large Print Internet Monitor<BR>
<INPUT type="checkbox" name="assistivetech[]" value="Video Eye">Video Eye<BR>
<INPUT type="checkbox" name="assistivetech[]" value="Sign Interpreter">Sign Interpreter<BR>
<INPUT type="checkbox" name="assistivetech[]" value="Infra-Red Listening System">Infra-Red Listening System in Meeting Room<BR>
<INPUT type="checkbox" name="assistivetech[]" value="Wheelchair Accessible Meeting Room">Wheelchair Accessible Meeting Room<BR>
<INPUT type="checkbox" name="assistivetech[]" value="Motorized Scooter">Motorized Scooter<BR>
<INPUT type="checkbox" name="assistivetech[]" value="Wheeled Walker">Wheeled Walker<BR>

I've tried several ways to try to get these to show up in the email, but the closest I get is this:

if (!isset($assistivetech)) $assistivetech= array();
foreach ($assistivetech as $value)
{
$assistivetech_req .= "assistivetech: ".$value."\n";
}

Which gives me this in my email reply:

Assistive Technology Devices: Array

I can't get a list of checked items.

Any help would be greatly appreciated. I'm very new at this.

10:14 pm on Mar 3, 2006 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Sept 22, 2002
posts:1749
votes: 0


You can read the values of assistivetech by looping through the array $_POST['assistivetech'] - or $_GET['assistivetech'] if your form uses the get method.
10:58 pm on Mar 3, 2006 (gmt 0)

Preferred Member

10+ Year Member

joined:Dec 8, 2004
posts:500
votes: 0


for ($i=0; $i<count($_POST['assistivetech']); $i++){
$assistivetech_req = addslashes($_POST['assistivetech'][$i]);
//do this
//do that
}//end loop
2:42 pm on Mar 9, 2006 (gmt 0)

New User

10+ Year Member

joined:Nov 16, 2004
posts:3
votes: 0


Thank you!
I appreciate your help with this!
7:10 am on Mar 10, 2006 (gmt 0)

Preferred Member

10+ Year Member

joined:Dec 8, 2004
posts:500
votes: 0


welcome :)