Page 1 of 1

Multiple Pages - One Page

Posted: Mon Nov 28, 2005 11:23 pm
by nickman013
Hello,

I need help making a script for my page.

I would like to make a index.php page and then when ?page=home is added to that, it goes to the home page, when ?page=aboutus is added to that it goes to the About Us page.

ex.

http://www.mysite.com/index.php?page=home - Home Page
http://www.mysite.com/index.php?page=contactus - Contact Us Page
http://www.mysite.com/index.php3page=support - Support Page


If possible can someone just show me a simple script.

A Website that uses the page script I want is http://www.edgz.com.

Thank You

Posted: Mon Nov 28, 2005 11:28 pm
by John Cartwright
check out "Proper use of $_GET with includes: $_GET and include" link found in the Usefull Posts Thread

Posted: Mon Nov 28, 2005 11:43 pm
by nickman013
ok, I found a code that i think is right...

Code: Select all

<?
switch ($_GET['file']) { 
    case "index": include("index.inc.php"); break; 
    case "file1": include("file1.inc.php"); break; 
    case "file2": include("file2.inc.php"); break; 
    case "file3": include("file3.inc.php"); break; 
    default: include("index.inc.php"); break; 
}

?>
so if i wanted to go to the index page, my link would be http://www.mysite.com/index.php?file=index

because if thats the case i get a parse error
Parse error: parse error, expecting `'}'' in /web/u54/www22882/www/nicky/get33.php3 on line 3
I get the error without putting the ?file=index after the url anyway.

Re: Multiple Pages - One Page

Posted: Mon Nov 28, 2005 11:44 pm
by josh
nickman013 wrote: A Website that uses the page script I want is http://www.edgz.com.
A website that does it *wrong* I might add

Edit: Is that your entire script, or is line 3 something different?

Re: Multiple Pages - One Page

Posted: Mon Nov 28, 2005 11:45 pm
by nickman013
jshpro2 wrote:
nickman013 wrote: A Website that uses the page script I want is http://www.edgz.com.
A website that does it *wrong* I might add
:D lol

Posted: Tue Nov 29, 2005 12:10 am
by Charles256
wow..that page blindly trusts that URL..blindly...way blindly..oh my lord...someone e-mail him! (i'm too lazy:) )

Posted: Tue Nov 29, 2005 12:23 am
by josh
or instead of emailing him, write him a message on his home page, hell take it more seriously :lol: