Hello,
I am currently making a form that includes a "calendar" made up of checkboxes. The customer checks the boxes he/she would like. All the check boxes are given the same name so that javascript will put them into an array and i can go through and calculate a deposit based on how many days are checked. This works fine. The problem comes when i try to pass the information to a php file to insert the data into my database. When i refernce the check boxes (named Day) my php page only reads the first checkbox. Is there a way to pass an array of checkboxes to a php file? here's the code:
html form:
index.php:
<tr align="center">
<td>6/23 - 6/27</td>
<td><input name="Day" type="checkbox" checked></td>
<td><input name="Day" type="checkbox"></td>
<td><input name="Day" type="checkbox" checked></td>
<td><input name="Day" type="checkbox"></td>
<td><input name="Day" type="checkbox" checked></td>
</tr>
form_process.php
$sqlquery = "INSERT INTO campers
(
last_name,first_name,address,
city, state, zip,
gender,
june16, june17
)
VALUES
(
'$camp_lname','$camp_fname','$address',
'$city', '$state', '$zip',
'$gender',
'$Day[0]', '$Day[1]'
)";
$results = mysql_query($sqlquery);
All the other data in my querey ($camp_lname, $camp_fname, etc) is entered correctly into the database but the $Day is just given the value of "on" and so the $Day[0] is therefore given the value of 'o' and the $Day[1] is given the value of 'n'. I am currently trying to use hidden fields in my form to pass the values to the processing page but I am still facing roadblocks. Any advice will be apprechiated.
Thank you,
Robin