mahirharoon 0 Report post Posted December 2, 2007 this is my first topic(not post) i had posted it in another place <?php $variable = $_GET['id'];switch($variable) {default: include('home.php'); break;case "guestbook": include('guestbook.php'); break;}?>instructions: case "guestbook": include([u]'guestbook.php'[/u]); break; = change - guestbook.php to the page url forum - change to your id (underlined) which will come in index.php?id=[u]forum[/u] $variable = $_GET['id']; -change id to what you want here (underlined) index.php?id=123 Share this post Link to post Share on other sites
jlhaslip 4 Report post Posted December 2, 2007 I am thinking that the Code should read as follows so that the default case gets handled after the check for "id". <?php$variable = $_GET['id'];switch($variable) {case "guestbook": include('guestbook.php'); break;default: include('home.php'); break;}?>The Default case is a 'fall through' value. If there is not a 'break' for any other, correct, value, then the Default is applied.Correct me if I am wrong. Thanks. Share this post Link to post Share on other sites
mahirharoon 0 Report post Posted December 3, 2007 hellobut i think that the server first looks what first Share this post Link to post Share on other sites
hippiman 0 Report post Posted December 7, 2007 I'm pretty sure 'default' is alway supposed to come last, because it has to check all the other values to know if it has the default. If you put the default first, it's not even going to check any of the cases.And it might be better to use the $_POST variable, instead of $_GET, because get shows in the URL. You can look it up, if you want. If you use get, you could do the same kind of thing with javascript, because I think you can get the variables from a method='get' with javascript, too. That way, it doesn't matter if you have PHP installed on the server, but it might matter what browser you're using. Share this post Link to post Share on other sites