Page 1 of 1
how to keep all values in URL when submitting from a form
Posted: Thu Jul 17, 2003 10:36 am
by deejay
Hi
What I am trying to do is be able to keep all details that are in the URL after submitting from a form. i am using $PHP_SELF and all details after .php? seem to get lost. Have also looked at using
Code: Select all
$PHP_SELF
$_SERVERї'HTTP_HOST']
$_GETї'URI']
$_SERVER
and i dont think they do what i want them to. Any ideas?
Posted: Thu Jul 17, 2003 10:42 am
by RTT
Set your form method to "GET" rather than "POST".
Code: Select all
<form name="formname" action="" method="GET">
Hope this helps!
Posted: Thu Jul 17, 2003 10:45 am
by nielsene
$_SERVER["QUERY_STRING"]
Posted: Thu Jul 17, 2003 11:06 am
by deejay
thanks,
i don't suppose you know a good resource website where it lists all Super globals and this sort of stuff, i seem to find
http://www.php.net difficult to locate what i need to find out.
Posted: Thu Jul 17, 2003 11:19 am
by nielsene
I actually normally just use a phpinfo(); page. Down at the bottom almost all of the SERVER/_ENV variables are echoed out and normally I can tell which one I want from the current value. (Of course QUERY_STRING is an exception as its blank on a phpinfo page, but I knew roughly what I was looking for name-wise....)
Posted: Thu Jul 17, 2003 11:25 am
by deejay
actually i found that $_SERVER["QUERY_STRING"] returned
Code: Select all
res://C:\WINDOWS\System32\shdoclc.dll/http_404.htm#https://www1.securesiteserver.co.uk/cctvcity/MonitoringStation/user_id=95&cam=camera2
whereas i just want the info after # .
Thanks
Posted: Thu Jul 17, 2003 11:29 am
by RTT
deejay wrote:actually i found that $_SERVER["QUERY_STRING"] returned
Code: Select all
res://C:\WINDOWS\System32\shdoclc.dll/http_404.htm#https://www1.securesiteserver.co.uk/cctvcity/MonitoringStation/user_id=95&cam=camera2
whereas i just want the info after # .
Thanks
Which is why I suggested changing your form method to GET rather than POST

Posted: Thu Jul 17, 2003 11:36 am
by deejay
RTT
it didn't work, although I'm not sure quite why as I agree it should sort it.
anyhow just worked out you can get a list of $_SERVER commands by using
echo '<pre>';
print_r($_SERVER);
echo '</pre>';
think i should be able to sort it now.
Thanks all