Jump to content

1 PHP file for multiple set's of information


ev5unleash

Recommended Posts

I was looking at php sites, for example as I post this and look at the address bar.

 

I want to know how to have one Php file and add muliple page into it so if I wanted to show news it would look something like index.php?show=news. I'm new to PHP but I was wondering if anyone could help me out.



<?php $page = $_GET["page"];
if (!$page) {
include "/home.php";
}
else if($page=="Home")                { include "/home.php"; }             //index.php?page=Home is really Home.php 

else if($page=="Forum")                { include "/forum.php"; }             //index.php?page=forum is really forum.php

else { echo "<b><h1>404 Error</h1></b>"; } 
?>


I keep getting error messages with the regular file and it won't view when i put it the info.php?page=welcome.html

 

Warning: include(/welcome.html) [function.include]: failed to open stream: No such file or directory in /var/www/homepage/info.php on line 5

 

Warning: include() [function.include]: Failed opening '/welcome.html' for inclusion (include_path='.:/usr/share/php:/usr/share/pear') in /var/www/homepage/info.php on line 5

 

With the URL http://www1.ev5unleash.com:1212/homepage/info.php?page=welcome

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.