homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

html form checkbox: array?
how do I know what boxes have been checked

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

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)

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)

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)

Thank you!
I appreciate your help with this!


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

welcome :)

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved