Hi guys,
I’ve created a booking form on my website for people to book appointments from a list of dates. I have it set to produce 120 days from the current day. It’s been working fine all year but since the 120th day has hit December 31st/Jan 1st it’s no longer producing the list. I can only assume this is due to it trying to look further than December in the same year - which there obviously isn’t any more days in this year… So, how do I get it to start a new year, from Jan 1st…?
Any help would be great.
<option selected disabled value="select-date">Select a date</option>
<?php
date_default_timezone_set('Europe/London');
// Start date
$date = date('l jS F');
// End date
$end_date = date('l jS F', strtotime("+120 days"));
while (strtotime($date) <= strtotime($end_date)) {
echo "<option value=\\"$date\
\\">$date\
</option>";
$date = date ('l jS F', strtotime("+1 days", strtotime($date)));
}
?>
</select>