Syke Posted December 11, 2008 Share Posted December 11, 2008 Hey everyone, hoping anyone can help me. This is the code my friend gave to me. This code: <?php $f = $_GET['pg']; if($f == null){ $f = "home"; } if(file_exists($f . ".php")){ include($f . ".php"); }else{ echo("File not found."); } ?> would go into the table in which i want each file to load. and each link would be: index.php?pg=file2 / index.php?pg=file3 and so on. this is what im looking for, but for some reason it's not working for me. can anyone simplify it and rewrite it for me? Thankyou in advance. Link to comment https://forums.phpfreaks.com/topic/136510-solved-help-with-existing-php-nav-very-simple-version/ Share on other sites More sharing options...
gevans Posted December 11, 2008 Share Posted December 11, 2008 $f = (isset($_GET['pg'])) ? $_GET['pg'] : 'home'; if(file_exists($f . ".php")) include($f . ".php"); else include("home.php"); Link to comment https://forums.phpfreaks.com/topic/136510-solved-help-with-existing-php-nav-very-simple-version/#findComment-712548 Share on other sites More sharing options...
Syke Posted December 11, 2008 Author Share Posted December 11, 2008 Oh my god, your a legend. I've been trying soo many different things, im a beginner, so thankyou. Very much. Link to comment https://forums.phpfreaks.com/topic/136510-solved-help-with-existing-php-nav-very-simple-version/#findComment-712556 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.