Jump to content

Could someone tell me why my code dont work?


MasterRenny

Recommended Posts

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
Share on other sites

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
Share on other sites

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
Share on other sites

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* :P

 

=]

 

 

But yes it didnt work, and since i put that code in my page it works fine now!

 

thanks again

Link to comment
Share on other sites

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* :P

 

=]

 

 

But yes it didnt work, and since i put that code in my page it works fine now!

 

thanks again

 

I beg to differ. :P 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
Share on other sites

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.