Re: "Boolean" parameter passing

From: Date: Wed, 19 Jul 2000 13:38:02 +0000
Subject: Re: "Boolean" parameter passing
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-7345@lists.php.net to get a copy of this message
Hi On 18-Jul-00 14:00:28, Niklas Brunlid (niklasb@axis.com) wrote: > I've looked around for this but can't find it... > Is there any way to check for a CGI variable that doesn't have a value? > Something like this: > "http://my.domain/my_script.php?useThisAndThat" > instead of: > "http://my.domain/my_script.php?useThisAndThat=1" > I suppose HTTP_POST_VARS can be used by if there is another way I'd like > to use it... HTTP_GET_VARS, you mean. You'd have to look at $QUERY_STRING yourself, but why would you need to? What's wrong with ?foo=1 ? Actually, if you want a nice clean URL, and you're using Linux and Apache, you could do a bit of .htaccess fiddling, rename your script to just my_script, ForceType it to php, and use my_script/foo/ (in fact, my_script.php/foo/ works too). This code fragment splits the URL into the constituent arguments. It's handy if you want spiders to index your dynamic pages <?php $querypath=substr($REQUEST_URI,strlen($SCRIPT_NAME)+1); $foo=split("/",$querypath); $i=0; while(list($a,$b) = each($foo)) { echo $i++ . " => $b\n"; } ?> Regards Tom -- Thomas 'Freaky' Hurst - On ARCNet - http://arcnet.vapor.com/ Team Member of AmiBench - http://www.amibench.org/ Full time ARexx, PHP, Linux and Amiga freak, student and bum -- "The greatest pleasure in life is doing what people say you cannot do."

« previous php.general (#7345) next »