Jump to content

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

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.