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'); } ?> Link to comment https://forums.phpfreaks.com/topic/61062-solved-_get-not-working/ 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"); } Link to comment https://forums.phpfreaks.com/topic/61062-solved-_get-not-working/#findComment-303874 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 Link to comment https://forums.phpfreaks.com/topic/61062-solved-_get-not-working/#findComment-303876 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 Link to comment https://forums.phpfreaks.com/topic/61062-solved-_get-not-working/#findComment-303880 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); } ?> Link to comment https://forums.phpfreaks.com/topic/61062-solved-_get-not-working/#findComment-303882 Share on other sites More sharing options...
Northern Flame Posted July 21, 2007 Author Share Posted July 21, 2007 it works now, thanks Link to comment https://forums.phpfreaks.com/topic/61062-solved-_get-not-working/#findComment-303887 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.