Bitcoin Forum
May 30, 2024, 08:37:49 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Need a coder: Displaying content based on the specifics of a URL.  (Read 274 times)
MoreBloodWine (OP)
Legendary
*
Offline Offline

Activity: 1050
Merit: 1001


View Profile
February 12, 2015, 04:03:28 AM
Last edit: February 12, 2015, 05:47:14 AM by MoreBloodWine
 #1

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:
<?php

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

?>

To be decided...
Bitsky
Hero Member
*****
Offline Offline

Activity: 576
Merit: 514


View Profile
February 12, 2015, 06:10:13 PM
 #2

Try this:
Code:
<?php

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";
}

?>

Bounty: Earn up to 68.7 BTC
Like my post? Feel free to drop a tip to 1BitskyZbfR4irjyXDaGAM2wYKQknwX36Y
MoreBloodWine (OP)
Legendary
*
Offline Offline

Activity: 1050
Merit: 1001


View Profile
February 13, 2015, 01:52:34 AM
 #3

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 ;-)

To be decided...
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!