Page 1 of 1
$variable ghosts
Posted: Wed Jul 16, 2003 8:24 pm
by Gen-ik
I was wondering if it's possible to send a 'dead' or 'ghost' variable to a PHP page... like this... my_php_page.php?BOB
...and then in the PHP page check if BOBs 'ghost' is there?
I've tried
but it tells me that BOB doesn't exist. Is there another way of checking?
There is a reason for me wanting to do this but I don't want to do something like... my_php_page.php?BOB=1 ...even though I know it will work.
Any ideas?
Posted: Thu Jul 17, 2003 2:23 am
by m@ndio
so you wana send a variable with no value?
Posted: Thu Jul 17, 2003 2:46 am
by Gen-ik
er.. yep. That sums it up nicely.
Can it be done?
Posted: Thu Jul 17, 2003 3:07 am
by Tubbietoeter
sure you can
thesite.php?BOB=&
Posted: Thu Jul 17, 2003 8:19 am
by m@ndio
that wont work, as php will convert this to a string value conaining nothing.
Posted: Thu Jul 17, 2003 9:53 am
by Gen-ik
Basically I'm just trying to make things look tidy.
Instead of the url looking something like news.php?latest=1, or news.php?latest=true.... I'm just trying to see if it's possible to just use news.php?latest
..maybe I should checkout the $POST variables and stuff to see if that can see a 'ghost' variable...... or even rip apart the url in PHP and see what's at the end of it.
Any suggestions would be cool

Posted: Thu Jul 17, 2003 10:22 am
by RTT
woooo, my first post here!
Perhaps you could use...
Code: Select all
$check = explode("?", $_SERVER['REQUEST_URI']);
if($check[1] == 'latest') {
//show latest news
} else {
//do something else
}
Seems to work -- links...
http://richthetitch.net/php/uri.php
http://richthetitch.net/php/uri.php?latest

Posted: Thu Jul 17, 2003 11:08 am
by Gen-ik
Ah... sweet. Just what I was after... good 'ol PHP
Cheers mate.
Posted: Thu Jul 17, 2003 1:03 pm
by jamesm87
Surly to check Isset you have to do it in an
If Clause
eg
Code: Select all
<?php
if (isset($ghost))
{
blah
}
?>
But then again I might just have the wrong Idea!
Posted: Thu Jul 17, 2003 1:30 pm
by Gen-ik
jamesm87 wrote:Surly to check Isset you have to do it in an If Clause
Yeah I know I was just being lazy and lot typing all the code
?>