Welcome to WebmasterWorld Guest from

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)

10+ Year Member

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)

WebmasterWorld Senior Member 10+ Year Member

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)

10+ Year Member

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)

10+ Year Member

Thank you!
I appreciate your help with this!


7:10 am on Mar 10, 2006 (gmt 0)

10+ Year Member

welcome :)

Featured Threads

Hot Threads This Week

Hot Threads This Month