vendredi 18 août 2017

Multiple checkboxes with one name (no jquery!)

I have a following list of checkboxes:

<input type="checkbox" name="day_of_week" value="1">Monday
<input type="checkbox" name="day_of_week" value="2">Tuesday
<input type="checkbox" name="day_of_week" value="3">Wednessday
<input type="checkbox" name="day_of_week" value="4">Thursday
<input type="checkbox" name="day_of_week" value="5">Friday
<input type="checkbox" name="day_of_week" value="6">Saturday
<input type="checkbox" name="day_of_week" value="7">Sunday

After user submits the full form, I receive it in another file:

$week_days = mysqli_real_escape_string($this->db->conn_id, $_POST['day_of_week'])

But then $week_days only contains the value of the last checked checkbox, not all of them. How can I receive all the values?




Aucun commentaire:

Enregistrer un commentaire