I am new to this website and just want to say thank you in advance for any assistance. So, I have a form that's linked to a separate PHP script, and everything else on the form inserts into the database just fine except for the check boxes. The current code I have below received the "Undefined index:" error and I have tried following many tutorials but this is as far as I've gotten thus far.
Here is my HTML code for the checkboxes:
<input type="checkbox" name="problem_list[]" value="Handle Bars">Handle Bars<br>
<input type="checkbox" name="problem_list[]" value="Frame">Frame<br>
<input type="checkbox" name="problem_list[]" value="Pedals">Pedals<br>
<input type="checkbox" name="problem_list[]" value="Chain">Chain<br>
<input type="checkbox" name="problem_list[]" value="Brakes">Brakes<br>
<input type="checkbox" name="problem_list[]" value="Gears">Gears<br>
<input type="checkbox" name="problem_list[]" value="Tires">Tires<br>
And here is my PHP code for related to the checkboxes:
$problem_list = ""; // declare problem_list
if (isset($_POST["problem_list"]))
{$problem_list = implode(" ,",$_POST['problem_list']);
}
$sql = "INSERT INTO bike_repairs (employee_id, date, first_name, last_name, phone, email, make, model, color, overall_problem_area, specific_issue)
VALUES ('$value16', '$value5', '$value6', '$value7', '$value8', '$value9', '$value10', '$value11', '$value12', '".$problem_list."', '$value14')";
Just to recap, the form works, the database connection is established, all other form elements are accounted for in variables and inserting just fine. So this is the last thing I need to figure out. Thanks again for any assistance!