Simple Php script to load different pages for different days

by 5 replies
6
Please I want to make a php script which pulls up a page, and after a specified date, pulls up another script,
e.g my sales page contains a countdown timer that expires on a specified date, and after that date, a new page should be pulled up.

I did the script below:

PHP Code:
date_default_timezone_set("Africa/Lagos");
$date=date("d F Y");

if (
$date <= '31 December 2011')
{
include 
'pagedecember.html';
}
else
include 
'pagejanuary.html'

Please any suggestions on making this work?
Thanks.
#programming #days #load #pages #php #script #simple
  • You are comparing strings, not dates.
    • [1] reply
    • I'm confused? Im sorry I'm really new to php and all
  • Thanks a million :-)
  • A more flexible solution that you might find more useful - depending on future needs

    PHP Code:

    switch () 
        { 
        case (==
    'Dec'): 
        
    //dec
            
    break; 
        case (==
    'Jan' || =='Feb' || =='Mar'): 
        
    //Q1
            
    break; 

        default :

        break;
        
        } 

Next Topics on Trending Feed