Forum Moderators: coopster

Message Too Old, No Replies

SERVER[REQUEST_URI] returning only first query string

         

varunkrish

5:18 pm on Aug 9, 2005 (gmt 0)

10+ Year Member



i want to log errors on my site

i used
$p=$_SERVER["REQUEST_URI"];
if($notfound){
header("Location:404.php?p=$p");
}

on the error handler page 404.php i used this code

echo ($_GET['p'])."not found";

problem
test2.php?a=term1&b=term2

prints
/test2.php?a=term1
on the error page

how can i get the entire value for the user request and log it

dreamcatcher

5:21 pm on Aug 9, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi varunkrish,

Have you tried using $_SERVER['PHP_SELF'] & $_SERVER['QUERY_STRING']?

dc

varunkrish

2:31 am on Aug 10, 2005 (gmt 0)

10+ Year Member



dear dreamcatcher,

i tried phpself

it returns only the page (the php file)

my aim is to get the entire url the user typed in the brower

its of the form
test2.php?a=term1&b=term2

i tried $_SERVER["REQUEST_URI"]
result prints /test2.php?a=term1

$_SERVER['PHP_SELF'] prints test2.php

$_SERVER['QUERY_STRING'] prints /test2.php?a=term1&b=term2 on test2.php but if i pass it to another page the part after the "&" gets cut

How could i get entire path and qry string

please help

brendan3eb

4:13 am on Aug 10, 2005 (gmt 0)

10+ Year Member



you could try passing it to the next page using sessions:

//page of error
$url = "this page";
session_start();
session_register("url");

//404.php
session_start();
echo $url;

P.S. session_register() kicks $_SESSION's behind

varunkrish

3:52 pm on Aug 11, 2005 (gmt 0)

10+ Year Member



great idea!

thanks

for all ur help

manage to track it using session