BrainSmasher Posted October 4, 2006 Share Posted October 4, 2006 I got this code already if(isset($_GET['page'])){if($_GET['page'] == ""){include("menu.php");}if($_GET['page'] == "form"){include("formular.php");}else{echo "This page doesnt exists!";}} But now my question is how to include main.php if no variable or an other variable like ?id is set Link to comment Share on other sites More sharing options...
BrainSmasher Posted October 5, 2006 Author Share Posted October 5, 2006 someone there? Link to comment Share on other sites More sharing options...
www.mihalism.com Posted October 5, 2006 Share Posted October 5, 2006 here i made your code the way i think you want iti dont really see a reason for the isset() so i did not put it in the code <?php//include main.php if no var is selectedif(!$_GET['page']){include('main.php');}//include other pageselseif($_GET['page'] == ""){include("menu.php");}elseif($_GET['page'] == "form"){include("formular.php");}else{echo "This page doesnt excists!";}?> Link to comment Share on other sites More sharing options...
BrainSmasher Posted October 5, 2006 Author Share Posted October 5, 2006 if i dont use isset it gives an error Link to comment Share on other sites More sharing options...
jhecht Posted October 6, 2006 Share Posted October 6, 2006 I dont get what you are asking...If those are all the things that you are checking for, then just put include("main.php") in the else statement of your code. Link to comment Share on other sites More sharing options...
BrainSmasher Posted October 6, 2006 Author Share Posted October 6, 2006 NVM then.I cant explain it better Link to comment Share on other sites More sharing options...
wannabe_god Posted October 10, 2006 Share Posted October 10, 2006 do u want something like this: if (file_exists($_GET["page"] . ".php")) include($_GET["page"] . ".php")else include("main.php") ? Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now