Your code almost worked... except it displayed the same page repeatedly, despite the contents of 1, 2, 3, 4, 5, 6 and 7.php all being different.
How would I fix this? This code is for my localhost radio station site (virtualhost name on Apache www.mylocalhostradiosite.co.uk)
and the URLs are meant to be:
http://www.mylocalhostradiosite.co.u...dule.php?day=3
(with the content changing per day).
Thanks for your help so far
Your links don't work.
BTW: Atli's solution is much nicer than mine - I attempted to fix your code, whereas he's done a complete makeover. His code works as long as you synchronize the 'day number' with the include file name. However, if you were to have different filenames for certain days or even the same filenames for certain days (e.g. Sat/Sun both using the same file), the code wouldn't work 'as is'.
With regard to forcing an integer value on any $_GET value, this is useful if you don't care about assigning a default day or applying a day if the value is 'close'. This should be fine if using the date('N') - Atli points out, valid days = 1 to 7, therefore a totally off the wall value will return a '0' - which can be used to throw an error. However, if you go with the 0 to 6 (date('w')), which I have to admit to favouring, you will find Sunday as the default page for incorrect querystrings.
Anyway, enough rambling. I'd give Atli's solution a go as it's much prettier.
//EDIT
If you want to see what's going on, try this:
if(isset($_GET['day']) && is_int($_GET['day']) && $_GET['day'] > 0 && $_GET['day'] < 8){
$dat = $_GET['day'];
echo "Good querystring: " . $dat;
}else{
$dat = date('N');
echo "Bad or no querystring, using today: " . $dat;
}
Also, "case3:" later on refers to page2.php - should be page3.php.