Click to See Complete Forum and Search --> : $_server['php_self']


prachu
01-09-2008, 02:32 PM
Hi all

I am aware that PHP_SELF gives the address of the page

for eg if the page url is http://localhost/geo.php

then the value of PHP_SELF is /geo.php

If my page url was http://localhost/geo.php?var1=1&var2=2

I still get PHP_SELF to be /geo.php.

But what I need is /geo.php?var1=1&var2=2

How can I get this? any help is appreciated. thanks

bokeh
01-09-2008, 02:36 PM
REQUEST_URI

prachu
01-09-2008, 02:40 PM
thank you

prachu
01-09-2008, 02:54 PM
REQUEST_URI gives me

/geo.php?var1=var1

but how can i get

/geo.php?var1=var1&var2=var2

thanks

prachu
01-09-2008, 03:03 PM
I actually want to get the value of REQUEST_URI which is /geo.php?var1=var&var2=var2

I would then like to assign this to a variable say $page and then transport that information to another page say

something like http://localhost/location.php?id=123&page=$page

then when i try to extract the value of $page by using $_REQUEST['page'], i get

/geo.php?var1=var1

this is because there is another & sign before var2 so var2 is not considered a part of $_REQUEST['page']

TJ111
01-09-2008, 03:09 PM
you want the entire query string to be passes as a variable in the next request?

$page = $_SERVER['QUERY_STRING'];
header("Location: http://localhost/location.php?id=123&page=$page");

prachu
01-09-2008, 03:19 PM
the query string by itself would contain multiple & right?

in such a case how can i get the value of $_REQUEST['page'] to be the entire query string?

TJ111
01-09-2008, 03:30 PM
hmm, i'm not exactly sure what your asking.

//if you were at the address yoursite.com/file.php?var1=test&var2=example
$_GET['var1'] // = "test"
$_GET['var2'] // = "example"
$_SERVER['QUERY_STRING'] // = "?var1=test&var2=example