Author

Topic: Need a coder: Displaying content based on the specifics of a URL. (Read 275 times)

legendary
Activity: 1064
Merit: 1001
Ty for that, ended up getting a solution from another post I made on another site first that works... never did test your code but ty all the same ;-)
hero member
Activity: 576
Merit: 514
Try this:
Code:

if (isset($_GET['players'])) { $players $_GET['players']; }
else { 
$players ''; }
$players preg_replace('/[^A-Za-z0-9]/'''$players);

if (
$players == 'current') {
echo "Test A";
}
elseif (
$players == 'previous') {
echo "Test B";
}
else {
echo "Test C";
}

?>
legendary
Activity: 1064
Merit: 1001
index.php?page=lottery

Ok, that so that's (the above link) a page address of one of my sites. I'd like to do something like this which I know is possible but don't recall how since it's been years since I've required this kind of set up.

I would like to do something like this, based on the URL.

This: index.php?page=lottery&players=current

Displays: Content A

AND

This: index.php?page=lottery&players=previous

Displays: Content B

all the while...

This: index.php?page=lottery

Displays: Original Content

-------

So can anyone help me out here ?

Would like this done in PHP vs something like JS.

Ty in advance.

Edit: This is what I'm working with that doesn't seem to want to work.

Code:

$players $_GET['players'];
if (isset($players == 'current')) {
echo "Test A";
}
elseif (isset($players == 'previous')) {
echo "Test B";
}
else {
echo "Test C";
}

?>
Jump to: