/ Published in: PHP
I have been trying to solve my problems on stackoverflow, but none seems to help. Hopefully someone here could help me.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<tbody id="dataTable"> <tr> <td> <input type="text" class="form-control" name="startTime[]"> </td> <td> <input type="text" class="form-control" name="endTime[]"> </td> <td> <input type="checkbox" name="Monday[0]" value="1"> </td> <td> <input type="checkbox" name="Tuesday[0]" value="1"> </td> <td> <input type="checkbox" name="Wednesday[0]" value="1"> </td> <td> <input type="checkbox" name="Thursday[0]" value="1"> </td> <td> <input type="checkbox" name="Friday[0]" value="1"> </td> <td> <input type="button" class="btn btn-danger" value="Delete" onClick="deleteRow('dataTable')" /> </td> </tr> </tbody> //handleschedule.php// <?php } else { if ($_POST['startTime']) { foreach ($_POST["startTime"] as $key => $value) { $endTime = $_POST["endTime"][$key]; $sql = "INSERT INTO timetableschedule ( startTime, endTime, Monday, Tuesday, Wednesday, Thursday, Friday) " . "VALUES ('$value', '$endTime', '$monday', '$tuesday', '$wednesday', '$thursday', '$friday')"; } } echo "1 record added"; } ?>