Jump to content


Photo

Passing a Get variable without the variable name


  • Please log in to reply
3 replies to this topic

#1 jlove

jlove
  • New Members
  • Pip
  • Newbie
  • 1 posts

Posted 02 June 2006 - 01:12 PM

This is a simple question but it puzzles me..

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

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

#2 ysu

ysu
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 02 June 2006 - 01:17 PM

[!--quoteo(post=379314:date=Jun 2 2006, 11:12 PM:name=jlove)--][div class=\'quotetop\']QUOTE(jlove @ Jun 2 2006, 11:12 PM) View Post[/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 :
page.php?hello

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
_____________________________________________________________________

[a href="http://www.ysuprogramming.com/" target="_blank"]Ysu Programming web development[/a]

#3 asylum

asylum
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 03 June 2006 - 03:36 AM

$_SERVER['QUERY_STRING']

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

#4 wildteen88

wildteen88
  • Staff Alumni
  • Advanced Member
  • 10,482 posts
  • LocationUK, Bournemouth

Posted 03 June 2006 - 12:52 PM

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





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users