Jump to content

[SOLVED] go to a given page based on today's date


jeff5656

Recommended Posts

I have 12 files called april.htm, may.htm etc one for each month.

Can I insert php code into this:

 

<li><a href="schedules/february.htm" class="navText">next month</a></li>

 

to display the apprpriate month?  For instance if someone clicked the href link for "next month" it would go to the file named "february.htm" (because today is January), but if someone clicked the SAME link during March, it would call up the named "April.htm.

this is completely written from my mind, you might get some errors, but should get the idea.

 


$next_month = strtotime("+1 month",mktime(0,0,0,date("n"),1,date("Y")));
$next_month_label = date("F",$next_month);
$link = strtolower($next_month_label).'.html';

echo '<li><a href="schedules/'.$link.'" class="navText">'.$next_month_label.'</a></li>';

 

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.