Dropdown box to have the values for the next 30 days in PHP

Selection box to get value for next 30 days.

Following PHP script should do the trick. IT will get next 30 days list.

for($j = 0; $j < 30; $j++) {

    // Get the current year, month, and day
    $year  = date('y');
    $month = date('m');
    $day   = date('d') + $j;
    // Make sure we do not have too many days for the current month...if we do, subtract the two
    if($day > date('t')) {
        $day -= date('t');
        // We have increased a month too, by the way
        $month += 1;
        // Make sure we compensate for a new year
        if($month > 12) { $month = 1; $year++; }
    // Now make a timestamp of the current information
    $stamp = mktime(0,0,0,$month,$day,$year);
    // Substitue this with your dropdown code
    print date('D M d, Y', $stamp);
	echo "<br>";

If you have any queries, please do not hesitate to contact me at Jainish Senjaliya

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s