Friday, 28 March 2008

using .$_SERVER['']. - to get the url in the link

Firstly I know it's been a while since I've used my blog, but I do now intend to keep it much more uptodate.

I will try and write notes on anything I've had to search for on the web, looked in forums etc. Sometimes these write ups may need to be uploaded at the end of project once it goes live.

Know to the latest problem -

which server command should i use just to put the URL in the link - with no folders etc.

This is useful when the page thats sending the link is in another folder -

Example - you may be in /admin and the script displaying link is in /includes/ and then you want to access the same script from your root folder.

$_SERVER['HTTP_HOST'] - is the one you need - this give the result www.yourwebaddress.com

however when link you will need to put http:// inside the a href, otherwise your links may look like this http://www.yourwebsite.com/folder/www.yourwebsite.com/etc -





1 comment:

LittleRipples said...

as a footnote to this blog

check

http://uk.php.net/reserved.variables

for a full list of server statements -