eradinn Posted March 9, 2007 Share Posted March 9, 2007 hey i have a website that uses this php include code: <?php if(!$id || $id == ""){$id = "ff12/ff12";} ?> <?php include("$id.html"); ?> so when i get into ff12.php it includes the ff12/ff12/html file automatically. and when you click on another link on the ff12 menu eg, ff12/ff12_battle (ff12.php?id=ff12/ff12_combat_system) that file doesnt come up it just stays on the main ff12 page. since i changed hosts, (which uses php5) it doesnt work. is there fix for this problem? thanks in advance. Link to comment https://forums.phpfreaks.com/topic/41898-php-include-with-if/ Share on other sites More sharing options...
trq Posted March 9, 2007 Share Posted March 9, 2007 Assuming $id is being passed via the url it can now be found in $_GET['id']. Link to comment https://forums.phpfreaks.com/topic/41898-php-include-with-if/#findComment-203149 Share on other sites More sharing options...
eradinn Posted March 9, 2007 Author Share Posted March 9, 2007 so do replace $_GET['id'] wherever it says $id? Link to comment https://forums.phpfreaks.com/topic/41898-php-include-with-if/#findComment-203151 Share on other sites More sharing options...
trq Posted March 9, 2007 Share Posted March 9, 2007 Yes. Link to comment https://forums.phpfreaks.com/topic/41898-php-include-with-if/#findComment-203157 Share on other sites More sharing options...
Archadian Posted March 9, 2007 Share Posted March 9, 2007 or just do this $id = $_GET['id']; on the page your URL is pointing to then you can use $id Link to comment https://forums.phpfreaks.com/topic/41898-php-include-with-if/#findComment-203158 Share on other sites More sharing options...
eradinn Posted March 9, 2007 Author Share Posted March 9, 2007 thanks for the help, i really appreciate it. i changed the code to: <?php $id = $_GET['id']; ?> <?php if(!$id || $id == ""){$id = "ff12/ff12";} ?> <?php include("$id.html"); ?> and it works perfectly xD Link to comment https://forums.phpfreaks.com/topic/41898-php-include-with-if/#findComment-203174 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.