PHP Date Select

Hi all,

I am having a problem i have it working great for current month but i was wanting to know if the current month is selected is fine but when i want to select next month eg June it shows same date this is what i have atmm


<table align="center">
    	
    	<tr>
        	<th colspan="3">Event Date</th>
        </tr>
        <tr>
        	<th><select name="Day">
					<?php
					$day = date('d');
					$days_in_month = date('t', strtotime($year . '-' . $month . '-1'));
					for($i=$day;$i<=$days_in_month; $i++)
					{
						echo '<option value="'.$i.'">'.$i.'</option>';	
					}?>
				</select>
            </th>
        	<th><select name="Month">
					<?php
					$month = date('n');
					//$months_in_year = date('t', strtotime($month . '-' . $day . '-1'));
					for($i=$month;$i<=12; $i++)
					{
						$month_of_year = date($i);
						echo '<option value="'.$i.'">';
						if($i == 1)
						{
							echo 'Jan';	
						}
						else if($i == 2)
						{
							echo 'Feb';							
						}
						else if($i == 3)
						{
							echo 'March';
						}
						else if($i == 4)
						{
							echo 'April';							
						}
						else if($i == 5)
						{
							echo 'May';							
						}
						else if($i == 6)
						{
							echo 'June';							
						}
						else if($i == 7)
						{
							echo 'July';							
						}
						else if($i == 8)
						{
							echo 'Aug';							
						}
						else if($i == 9)
						{
							echo 'Sept';							
						}
						else if($i == 10)
						{
							echo 'Oct';							
						}
						else if($i == 11)
						{
							echo 'Nov';							
						}
						else if($i == 12)
						{
							echo 'Dec';							
						}
						echo '</option>';	
					}?>
				</select>
            </th>
        	<th></th>
        </tr>
        <tr>
        	<th colspan="3"><input type="button" name="snd" value="Book Event" /></th>
        </tr>
    </table>

What am i doing wrong as for next month it shud show dates before today in next month if today was selected in next month shud see 22,21,20,19,18 etc… all the way back to first month of that month

But what am i doing im doing somthing abit simular to


https://www.airpacific.com/

For their section on left handside there.

Thanks,William

Firstly should is not spelled shud, ‘a bit’ is two words, similar is not simular. If you write like this to your clients they’ll think you’re dumb.

As for your problem, sites like the one you linked use JS to detect when the month is changed to update the related field. You’ll either need to do that to build the days for a given month, or have the user submit the form and rebuild from there. Until that happens their selection is not processed at all.

okay sorry about that do you have any idea with javascript how i would b able to achieve these? maybe post a snippet or somthing??