Northern Flame Posted July 21, 2007 Share Posted July 21, 2007 I am working on a project and I want all the content to be displayed on the index of my Admin. So I wrote a script for this, but it displays all of the files that I ask for it to include, and none of the "submit" buttons work. Can anyone take a look and see what I did wrong? <?php $page = $_GET['page']; $generator = 'generator'; $admin = 'admin'; $links = 'links'; $results = 'results'; $success = 'success'; include('var/config.php'); include('login.php'); if($page == $generator){ include('generator.php'); } if($page == $admin){ include('admin.php'); } if($page == $links){ include('links.php'); } if($page == $results){ include('links_results.php'); } if($page == $success){ include('success.php'); } ?> Quote Link to comment Share on other sites More sharing options...
cooldude832 Posted July 21, 2007 Share Posted July 21, 2007 First off you don't really need to declare those constants ( i know they ain't constants) but use a switch or nothing at all like in this case <?php if(!empty($_GET['page'])){ include($_GET['page'].".php"); } Quote Link to comment Share on other sites More sharing options...
Northern Flame Posted July 21, 2007 Author Share Posted July 21, 2007 let me try this out and see if it works Quote Link to comment Share on other sites More sharing options...
Northern Flame Posted July 21, 2007 Author Share Posted July 21, 2007 I tried that but now nothing is displayed Quote Link to comment Share on other sites More sharing options...
cooldude832 Posted July 21, 2007 Share Posted July 21, 2007 try this, but its not very strong because if its not a valid page it will fail I used require to help test <?php if(!empty($_GET['page'])){ $page = $_GET['page']; $page .= ".php"; require($page); } ?> Quote Link to comment Share on other sites More sharing options...
Northern Flame Posted July 21, 2007 Author Share Posted July 21, 2007 it works now, thanks 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.