odetron Posted February 11, 2007 Share Posted February 11, 2007 $pg = 1; $_GET[$pg]; //Draws the page data if ($pg == 1) { include("news1.inc.html"); } if ($pg == 2) { include("news2.inc.html"); } what i whant this code to do is change the site content depending on what the url is. like index.php?pg=2 would bring up hello world 2 and just index. php would bring up hello world. but on both i keep getting the one for $pg = 1 why won't this work? Quote Link to comment Share on other sites More sharing options...
Jessica Posted February 11, 2007 Share Posted February 11, 2007 if(isset($_GET['pg']){ $pg = $_GET['pg']; }else{ $pg = 1; } Quote Link to comment Share on other sites More sharing options...
trq Posted February 11, 2007 Share Posted February 11, 2007 <?php if (isset($_GET['pg'])) { $pg = $_GET['pg']; switch ($pg) { case 1: include "news1.inc.html" ; break; case 2: include "news2.inc.html" ; break; default: include "news1.inc.html" ; break; } } ?> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.