MasterRenny Posted December 7, 2007 Share Posted December 7, 2007 Hello Ive been trying to debug my code, but i cant seem to see whats up with it! Heres My links <li><a HREF="?link=Home">Home</a> </li> <li><a HREF="?link=About">About</a></li> <li><a HREF="?link=Rules"> Rules</a></li> <li><a HREF="?link=News">News</a></li> <li><a HREF="?link=Downloads">Downloads</a></li> And heres my code for where i want it to show; <?PHP if($_GET['link'] == "Home"){ include("/news/show_news.php"); } elseif($_GET['link'] == "About"){ include("/about.html"); } elseif($_GET['link'] == "Rules"){ include("/rules.html"); } elseif($_GET['link'] == "News"){ include("/news/show_archives.php"); } elseif($_GET['link'] == "Downloads"){ include("/downloads.html"); } else{ include("/news/show_news.php"); } ?> any ideas? im really confuzed on why its not working becuase it use to work! Thanks, Renny Link to comment https://forums.phpfreaks.com/topic/80705-could-someone-tell-me-why-my-code-dont-work/ Share on other sites More sharing options...
helraizer Posted December 7, 2007 Share Posted December 7, 2007 In what way is it not working? Do you get any errors or just a blank screen? Give us something to work with here Aswell, add this to your file. error_reporting(E_ALL); ini_set('display_errors', true); Sam Link to comment https://forums.phpfreaks.com/topic/80705-could-someone-tell-me-why-my-code-dont-work/#findComment-409296 Share on other sites More sharing options...
MasterRenny Posted December 7, 2007 Author Share Posted December 7, 2007 Oh yer sorry forgot when i load it all all i get is a black page, and when i click on a link the page dont show http://www.spartansguild.co.uk/ <<<<< see =[ the massive blank area to the left is where the text is ment to show up And ok ill try adding the code =] Link to comment https://forums.phpfreaks.com/topic/80705-could-someone-tell-me-why-my-code-dont-work/#findComment-409299 Share on other sites More sharing options...
phpSensei Posted December 7, 2007 Share Posted December 7, 2007 Your including your files wrong, remove backslashes "/filename.html" before the filenames. Link to comment https://forums.phpfreaks.com/topic/80705-could-someone-tell-me-why-my-code-dont-work/#findComment-409301 Share on other sites More sharing options...
MasterRenny Posted December 7, 2007 Author Share Posted December 7, 2007 Your including your files wrong, remove "/filename.html" after the filenames. Wait, sorry misread it ok ill try it Link to comment https://forums.phpfreaks.com/topic/80705-could-someone-tell-me-why-my-code-dont-work/#findComment-409302 Share on other sites More sharing options...
phpSensei Posted December 7, 2007 Share Posted December 7, 2007 Your including your files wrong, remove "/filename.html" after the filenames. sorry dont understand oO try this <?php if($_GET['link'] == "Home"){ include("news/show_news.php"); } elseif($_GET['link'] == "About"){ include("about.html"); } elseif($_GET['link'] == "Rules"){ include("rules.html"); } elseif($_GET['link'] == "News"){ include("newsshow_archives.php"); } elseif($_GET['link'] == "Downloads"){ include("downloads.html"); } else{ include("news/show_news.php"); } ?> Link to comment https://forums.phpfreaks.com/topic/80705-could-someone-tell-me-why-my-code-dont-work/#findComment-409303 Share on other sites More sharing options...
MasterRenny Posted December 7, 2007 Author Share Posted December 7, 2007 Your including your files wrong, remove "/filename.html" after the filenames. sorry dont understand oO try this <?php if($_GET['link'] == "Home"){ include("news/show_news.php"); } elseif($_GET['link'] == "About"){ include("about.html"); } elseif($_GET['link'] == "Rules"){ include("rules.html"); } elseif($_GET['link'] == "News"){ include("newsshow_archives.php"); } elseif($_GET['link'] == "Downloads"){ include("downloads.html"); } else{ include("news/show_news.php"); } ?> Nope still dont work Link to comment https://forums.phpfreaks.com/topic/80705-could-someone-tell-me-why-my-code-dont-work/#findComment-409305 Share on other sites More sharing options...
phpSensei Posted December 7, 2007 Share Posted December 7, 2007 Can you post the entire script please? Or is this it? Also, you might want to try <?php error_reporting(E_ALL); ini_set('display_errors', true); ?> Link to comment https://forums.phpfreaks.com/topic/80705-could-someone-tell-me-why-my-code-dont-work/#findComment-409308 Share on other sites More sharing options...
MasterRenny Posted December 7, 2007 Author Share Posted December 7, 2007 Yay! it works! thank you so much =D!!! Link to comment https://forums.phpfreaks.com/topic/80705-could-someone-tell-me-why-my-code-dont-work/#findComment-409313 Share on other sites More sharing options...
phpSensei Posted December 7, 2007 Share Posted December 7, 2007 Yay! it works! thank you so much =D!!! Ya np, but did you say it didnt work? Link to comment https://forums.phpfreaks.com/topic/80705-could-someone-tell-me-why-my-code-dont-work/#findComment-409318 Share on other sites More sharing options...
helraizer Posted December 7, 2007 Share Posted December 7, 2007 Can you post the entire script please? Or is this it? Also, you might want to try <?php error_reporting(E_ALL); ini_set('display_errors', true); ?> Oh, he listens to you then. *sulks* Link to comment https://forums.phpfreaks.com/topic/80705-could-someone-tell-me-why-my-code-dont-work/#findComment-409319 Share on other sites More sharing options...
MasterRenny Posted December 7, 2007 Author Share Posted December 7, 2007 Can you post the entire script please? Or is this it? Also, you might want to try <?php error_reporting(E_ALL); ini_set('display_errors', true); ?> Oh, he listens to you then. *sulks* =] But yes it didnt work, and since i put that code in my page it works fine now! thanks again Link to comment https://forums.phpfreaks.com/topic/80705-could-someone-tell-me-why-my-code-dont-work/#findComment-409320 Share on other sites More sharing options...
helraizer Posted December 7, 2007 Share Posted December 7, 2007 Can you post the entire script please? Or is this it? Also, you might want to try <?php error_reporting(E_ALL); ini_set('display_errors', true); ?> Oh, he listens to you then. *sulks* =] But yes it didnt work, and since i put that code in my page it works fine now! thanks again I beg to differ. It works now in principle but in reality: Warning: main(about.html) [function.main]: failed to open stream: No such file or directory in /home/eternalg/public_html/index.php on line 53 Warning: main(about.html) [function.main]: failed to open stream: No such file or directory in /home/eternalg/public_html/index.php on line 53 Warning: main() [function.include]: Failed opening 'about.html' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/eternalg/public_html/index.php on line 53 -and- Warning: main(newsshow_archives.php) [function.main]: failed to open stream: No such file or directory in /home/eternalg/public_html/index.php on line 55 Warning: main(newsshow_archives.php) [function.main]: failed to open stream: No such file or directory in /home/eternalg/public_html/index.php on line 55 Warning: main() [function.include]: Failed opening 'newsshow_archives.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/eternalg/public_html/index.php on line 55 -and- Warning: main(downloads.html) [function.main]: failed to open stream: No such file or directory in /home/eternalg/public_html/index.php on line 56 Warning: main(downloads.html) [function.main]: failed to open stream: No such file or directory in /home/eternalg/public_html/index.php on line 56 Warning: main() [function.include]: Failed opening 'downloads.html' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/eternalg/public_html/index.php on line 56 Sam Link to comment https://forums.phpfreaks.com/topic/80705-could-someone-tell-me-why-my-code-dont-work/#findComment-409324 Share on other sites More sharing options...
MasterRenny Posted December 7, 2007 Author Share Posted December 7, 2007 Yer thats becuase ive not uploaded them 3 files yet =] ill upload them, give me a sec and then you'll see it all works nicely ^.^ Link to comment https://forums.phpfreaks.com/topic/80705-could-someone-tell-me-why-my-code-dont-work/#findComment-409328 Share on other sites More sharing options...
helraizer Posted December 7, 2007 Share Posted December 7, 2007 Yer thats becuase ive not uploaded them 3 files yet =] ill upload them, give me a sec and then you'll see it all works nicely ^.^ That could indeed explain it. Glad you got it working. Sam Link to comment https://forums.phpfreaks.com/topic/80705-could-someone-tell-me-why-my-code-dont-work/#findComment-409331 Share on other sites More sharing options...
phpSensei Posted December 7, 2007 Share Posted December 7, 2007 Yer thats becuase ive not uploaded them 3 files yet =] ill upload them, give me a sec and then you'll see it all works nicely ^.^ That could indeed explain it. Glad you got it working. Sam Despite the fact he didn't upload the files, he didn't include them the right way either. Link to comment https://forums.phpfreaks.com/topic/80705-could-someone-tell-me-why-my-code-dont-work/#findComment-409332 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.