Change Content According to URL

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
thirteen
Forum Newbie
Posts: 4
Joined: Tue Apr 13, 2010 7:44 am

Change Content According to URL

Post by thirteen »

I need to display different content according to the URL of the website.

For example:

If the url is: http://test.com/page.php?id=10&p=17&s=25&i=26 then the html displays <p>This is the first page</p>
If the url is: http://test.com/page.php?id=10&p=18&s=109&i=104 then the html displays <p>This is the second page</p>

How can it be done?
eskio
Forum Commoner
Posts: 66
Joined: Tue Apr 01, 2008 1:00 am

Re: Change Content According to URL

Post by eskio »

HI,
u have to retrieve your url variable with $_GET[].
$url_id = $_GET['id'];
$url_p = $_GET['p'];
$url_s = $_GET['s'];
$url_i = $_GET['i'];
and the u can use "if" or "switch" statement.
Post Reply