Retreive data...

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
shoxlx
Forum Newbie
Posts: 23
Joined: Tue Oct 11, 2005 10:42 pm

Retreive data...

Post by shoxlx »

Is their a way to get the information from the address bar?
foobar
Forum Regular
Posts: 613
Joined: Wed Sep 28, 2005 10:08 am

Re: Retreive data...

Post by foobar »

shoxlx wrote:Is their a way to get the information from the address bar?
You can't read what the user typed in at a given moment, but you can use the following to find what URL is currently being called:

Code: Select all

$url = $_SERVER['PHP_SELF'].'?'.$_SERVER['QUERY_STRING'];
If you want to know what the user just typed in, you'll have to use JS. AFAIK there is a way of finding out, but I'm not that great with JS.
User avatar
Jenk
DevNet Master
Posts: 3587
Joined: Mon Sep 19, 2005 6:24 am
Location: London

Post by Jenk »

$_SERVER['HTTP_HOST'] and $_SERVER['REQUEST_URI']

Though be warned, XSS/Injection is an issue with these.
Post Reply