Jump to content

Archived

This topic is now archived and is closed to further replies.

jlove

Passing a Get variable without the variable name

Recommended Posts

This is a simple question but it puzzles me..

If it pass a variable without the variable name ike this :
[code]page.php?hello[/code]

How do I catch tat in the PHP code? I've tried $_REQUEST[''] but that doesn't seem to work...

Share this post


Link to post
Share on other sites
[!--quoteo(post=379314:date=Jun 2 2006, 11:12 PM:name=jlove)--][div class=\'quotetop\']QUOTE(jlove @ Jun 2 2006, 11:12 PM) [snapback]379314[/snapback][/div][div class=\'quotemain\'][!--quotec--]
This is a simple question but it puzzles me..

If it pass a variable without the variable name ike this :
[code]page.php?hello[/code]

How do I catch tat in the PHP code? I've tried $_REQUEST[''] but that doesn't seem to work...
[/quote]
It's not a variable without name, it's a variable without value.
try to echo all $_GET values, or simply var_dump($_GET)
to see what I mean

Share this post


Link to post
Share on other sites
$_SERVER['QUERY_STRING']

that will get the query string as an actual string so you can simply pass a value without a variable name.

Share this post


Link to post
Share on other sites
Your best of looking into mod_rewrite instead. Its much easier.

What mod_rewrite can do is change the following url:
mysite.com/page.php?var1=hello&var2=world

into something like this:
mysite.com/page/hello/world

a friendly URL

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.