faqts : Computers : Programming : Languages : PHP : Sample Code

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

2 of 2 people (100%) answered Yes
Recently 2 of 2 people (100%) answered Yes

Entry

How can I have multilpe php includes on one page that can be called up by a link?

Jan 15th, 2007 21:41
Jim Dillon, Ahhh, I figured it out..


Here is the simple jist of it. The first one with the if( will be 
default included.

<a href="?go=file1">file1</a> | <a href="?go=file2">file2</a> | <a 
href="?go=file3">file3</a>

<?PHP
if($_GET['go'] == "" or $_GET['go'] == "file1"){
   include("file1.htm");
}
elseif($_GET['go'] == "file2"){
   include("file2.htm");
}
elseif($_GET['go'] == "file3"){
   include("file3.htm");
}
?>