Re: Please Help!!!! - Really BASIC stuff!

From: Date: Tue, 06 Mar 2001 21:02:48 +0000
Subject: Re: Please Help!!!! - Really BASIC stuff!
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-42804@lists.php.net to get a copy of this message
Hi Martin, It's important to know that "Stuff" in the Url like this are just variables. For example : foo.php?fruit=apples&dog=snoopy&others=huh&more=yep Now with foo.php we can do this (a few exceptions) : echo "$dog would like to each some $fruit"; And in your case, you have $page so let's compare your $page variable and include files accordingly. We'll be using an if statement which can be read about here : http://www.php.net/manual/en/control-structures.php This will do the job : <?php if ($page == 'visual') { echo '<h3>Visual Stuff is Good!</h3>'; include 'visual.txt'; } elseif ($page == 'audio') { echo '<h3>Welcome to Musical Section!</h3>'; include 'audio.inc'; } else { echo '<h3>Welcome to my site!</h3>'; include 'default.php'; } ?> Yes there are other ways but this is the simplest and you should (and will!) learn to use if/elseif/else which will be useful in the future. Regards, Philip Olson http://www.cornado.com/

« previous php.general (#42804) next »