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?
The name should be an array.
Hope this helps.
For your second error, mysqli_real_escape_string accepts second parameter as string and you are passing array. Please check this
Please use for loop to solve that error.