$day = substr($slot, 0, 3); $time = intval(substr($slot, 4, 2)); //counter for extra slots //Add to the array for how ever many slots there it for ($x = 1; $x <= intval($numberOfSlots); $x++) { $contents['timetable'][$day][$time] = $game; //Increment counters $time++; } $contents = serialize($contents); $thisTimetable->contents = $contents; $thisTimetable->save(); } function removeSlot() { } //Add new timetable if ($_POST['action'] == 'add') { addTimetable($_POST['timetableName'], $_POST['event']); header('Location: /timetables.php'); } //Edit timetable if ($_POST['action'] == 'edit') { editTimetable($_POST['timetableID'], $_POST['timetableName'], $_POST['status']); header('Location: /timetables.php?edit=' . $_POST['timetableID']); } //Add timetable slot if ($_POST['action'] == 'addTimeslot') { addSlot($_POST['timetableID'], $_POST['slotName'], $_POST['game'], $_POST['numberOfSlots']); header('Location: /timetables.php?edit=' . $_POST['timetableID']); }
<?php // require("connection.php"); include "models.php"; if (isset($_POST['addSlot'])) { addSlot(); } if (isset($_POST['addPlantName'])) { addPlantType($_POST['plantName']); } if (isset($_POST['plantIt'])) { plantIt($_POST['Plant']); } if (isset($_GET['harvest'])) { harvest($_GET['slotid']); } ?> <html> <head> </head> <body> <div id="addPlantType" class="modal hide"> <div class="modalbody"> <a href="" class="close right">close</a> <form action="index.php" method="post"> <input type="text" name="plantName" placeholder="Enter Plant Name"> <input type="submit" name="addPlantName" value="Add"> </form> </div> </div>