PDA

View Full Version : why is this not working?



dawizman
June 12th, 2002, 22:23
in my page (rm2k.php)this is the only php script I have:

<?php
if ($page == "1")
{include ('./rm2k/main.php');}
elseif ($page == "2")
{include ('./rm2k/games.php');}
elseif ($page == "3")
{include ('./rm2k/tut.php');}
elseif ($page == "4")
{include ('./rm2k/prog.php');}
elseif ($page == "5")
{INCLUDE ('./rm2k/gfx.php');}
elseif ($page == "6")
{include ('./rm2k/music.php');}
?>

And when, for instance I click on a link that looks like: <a href="rm2k.php?page=1>link</a> the file (main.php) does not show up. what am I doiing wrong?

agent007
June 12th, 2002, 23:10
Try this code, it might work:

<?php
if ($page == "1") {
include "(./rm2k/main.php)";
} elseif ($page == "2") {
include "(./rm2k/games.php)";
} elseif ($page == "3") {
include "(./rm2k/tut.php)";
} elseif ($page == "4") {
include "(./rm2k/prog.php)";
} elseif ($page == "5") {
include "(./rm2k/gfx.php)";
} elseif ($page == "6") {
include "(./rm2k/music.php)";
} else {
include "(./rm2k/main.php)";
}
?>

dawizman
June 12th, 2002, 23:37
ok, but when I do that, it brings up main.php no matter what the variable is set to.

spec
June 13th, 2002, 02:07
<?
switch($page){
case 1:
include "(./rm2k/games.php)";
break;
case 2:
include "(./rm2k/tut.php)";
break;
case 3:
include "(./rm2k/prog.php)";
break;
case 4:
include "(./rm2k/gfx.php)";
break;
case 5:
include "(./rm2k/music.php)";
break;
default:
include "(./rm2k/main.php)";
}
?>

dawizman
June 13th, 2002, 09:24
yes, thanks very much spec, that worked :D

spec
June 13th, 2002, 12:08
sorry i was so ttired last night i didnt see that u did this:
include"(bah)";
instead of
include('blah');