How to submit check boxes from a form

General discussions related to php

Moderators: macek, egami, gesf

User avatar
swirlee
Moderator
Moderator
Posts: 2272
Joined: Sat Jul 05, 2003 1:18 pm
Location: A bunk in the back
Contact:

Postby swirlee » Wed Jul 09, 2003 10:03 am

Either you must give each checkbox a different name, e.g.:

Code: Select all

<input type="checkbox" name="mybox1">
<input type="checkbox" name="mybox2">
...


Or you have to make an array from the checkbox values. This is done by putting "[]" at the end of the name in the HTML form:

Code: Select all

<input type="checkbox" name="mybox[]">
<input type="checkbox" name="mybox[]">
...


This will store all of the checkbox values in an array which may be accessed by $_REQUEST['mybox'];

Return to “PHP General”

Who is online

Users browsing this forum: No registered users and 14 guests