Consider the following code that was working perfectly yesterday, but now today (30th March), it has stopped working...
<form class="date">
<select name="date" onchange="this.form.submit()">
<?php
for ($i = 0; $i <= 60; ++$i) {
$time = strtotime(sprintf('+%d months', $i));
$value = date('Y-m', $time);
$label = date('F Y', $time);
$nowvalue = date('Y-m');
$nowlabel = date('F Y');
if(isset($_GET['date'])) {
if(strcmp($value,$_GET['date']) == 0) {
//If 0, $value and $_GET['date'] are the same: The option is selected
printf('<option value="%s" selected>%s</option>', $value, $label);
} else {
printf('<option value="%s">%s</option>', $value, $label);
}
} else {
if($value == $nowvalue) {
printf('<option value="%s" selected>%s</option>', $value, $label);
} else {
printf('<option value="%s">%s</option>', $value, $label);
}
}
}
?>
</select>
</form>
This outputs a select list of upcoming months, that onchange, reloads the page with a different query in the URL for the calendar on that page to react on.
If i manually update the query in the URL, it works fine, but this select list is repeating dates, have a look at the image below...
This cant be a coincidence that all of the months with the shortest days are missing, or in fact have been replaced with the same name as the month before?
Does anyone have an idea why this might be happening?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…