philrocksgca Posted October 29, 2008 Share Posted October 29, 2008 i really need some help bad lol so im a noob with php and i need some advice. i call content currently with "index.php?page=example" with this <?php if (isset($_GET['page'])&& $_GET['page'] != "") { $page = $_GET['page']; if (file_exists('pages/'.$page.'.php')) { @include ('pages/'.$page.'.php'); } elseif (!file_exists('pages/'.$page.'.php')) { echo 'Page you are requesting doesn´t exist'; } } else { @include ('pages/home.php'); } ?> but on a page im doing inside, i need to use a variable too like: "index.php?page=example&id=1" can someone help modify my script so i can get this to work Link to comment https://forums.phpfreaks.com/topic/130510-multiple-variables-in-php-url/ Share on other sites More sharing options...
corbin Posted October 29, 2008 Share Posted October 29, 2008 Google "php $_GET" Link to comment https://forums.phpfreaks.com/topic/130510-multiple-variables-in-php-url/#findComment-677086 Share on other sites More sharing options...
philrocksgca Posted October 29, 2008 Author Share Posted October 29, 2008 lol, how did i miss that... i might be retarded. lol, but thanks Link to comment https://forums.phpfreaks.com/topic/130510-multiple-variables-in-php-url/#findComment-677099 Share on other sites More sharing options...
asmith Posted October 29, 2008 Share Posted October 29, 2008 btw if (file_exists('pages/'.$page.'.php')) { @include ('pages/'.$page.'.php'); } elseif (!file_exists('pages/'.$page.'.php')) if (file_exists('pages/'.$page.'.php')) then for sure anything than that will be !file_exists('pages/'.$page.'.php'). All I'm saying is you don't need to say it again in elseif. just use else. if (file_exists('pages/'.$page.'.php')) { @include ('pages/'.$page.'.php'); } else Link to comment https://forums.phpfreaks.com/topic/130510-multiple-variables-in-php-url/#findComment-677170 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.