Never ending loop on year dropdown

I am trying to create some simple dropdown date pickers. I got the month and day ones working correctly, but for some reason the year one is not working. When I refresh the page, it gives me an endless refresh that never generates a page. I already tested to make sure the $datetime variable is registering, and that the $year variables is receiving value from $datetime, which it is fine. Here is the code:


$datetime = strtotime($mass[0]['date_time']);
$year = date("Y",$datetime);

$nowyear = date("Y");
for ($i = $nowyear; $i <= $nowyear + 9; $i++) {
	$this->general .= '<option value="' . $i . '"';
	if (isset($year) && $year == $i) {
		$this->general .= ' selected="selected"';
	}
	$this->general .= '>' . $i . '</option>'; 
	$i++;
}

You are incrementing $i twice each time around the loop - but that doesn’t explain why the loop gets stuck though.

That fixed it, thanks! I didn’t do that on the other two, so I’m not sure why I typed that one that one.

I guess I stated it wrong. It wasn’t in a never-ending loop. It was more that I would hit “Refresh,” and it would just refresh forever.

Thanks again! It’s amazing how one line of code can cause chaos!