Hi
I am totally stuck, basically I have 4 start times and 4 end times what I would like to do is compare each combination to make sure there is no overlap. ie Start time is 10:24 and end time is 11:15 for activity 1 and I dont want to allow any other activity to have a start or end time that overlaps with either of these times.
I plan to take these inputs and insert them into the database. I have written the code to format the times correctly but to not complicated things I have left this out, this assumes the time formats are correct. Can anyone point me in the direction of how I can prevent an overlap of times captured in the database.
Any help appreciated.
<?php
foreach($_POST['startTime'] as $k => $startTime) {
$endTime = $_POST['endTime'][$k];
**** I dont know how to compare the value combinations $startTime - $endtime
}
?>
<form action="test.php" method="post">
Activity 1 Start <input type="text" name="startTime[]" /> End <input type="text" name="endTime[]" /> <br /><br />
Activity 2 Start <input type="text" name="startTime[]" /> End <input type="text" name="endTime[]" /> <br /><br />
Activity 3 Start <input type="text" name="startTime[]" /> End <input type="text" name="endTime[]" /> <br /><br />
Activity 4 Start <input type="text" name="startTime[]" /> End <input type="text" name="endTime[]" /> <br /><br />
<input type="hidden" name="test" value="true" />
<input type="submit" name="submit" value="Go" />
</form>
I am totally stuck, basically I have 4 start times and 4 end times what I would like to do is compare each combination to make sure there is no overlap. ie Start time is 10:24 and end time is 11:15 for activity 1 and I dont want to allow any other activity to have a start or end time that overlaps with either of these times.
I plan to take these inputs and insert them into the database. I have written the code to format the times correctly but to not complicated things I have left this out, this assumes the time formats are correct. Can anyone point me in the direction of how I can prevent an overlap of times captured in the database.
Any help appreciated.
<?php
foreach($_POST['startTime'] as $k => $startTime) {
$endTime = $_POST['endTime'][$k];
**** I dont know how to compare the value combinations $startTime - $endtime
}
?>
<form action="test.php" method="post">
Activity 1 Start <input type="text" name="startTime[]" /> End <input type="text" name="endTime[]" /> <br /><br />
Activity 2 Start <input type="text" name="startTime[]" /> End <input type="text" name="endTime[]" /> <br /><br />
Activity 3 Start <input type="text" name="startTime[]" /> End <input type="text" name="endTime[]" /> <br /><br />
Activity 4 Start <input type="text" name="startTime[]" /> End <input type="text" name="endTime[]" /> <br /><br />
<input type="hidden" name="test" value="true" />
<input type="submit" name="submit" value="Go" />
</form>