Get the entire address in the address bar in PHP

Do you want to share WYSIWYG Web Builder tips, tricks, tutorials or useful HTML code? You can post it here...
(no questions or problems please, this section is not monitored by support).
Forum rules
This section is to share tips, tricks and tutorials related to WYSIWYG Web Builder.
Please do not post questions or problems here. They will not be answered.

PLEASE READ THE FORUM RULES BEFORE YOU POST:
viewtopic.php?f=12&t=1901
Post Reply
madjamonline
 
 
Posts: 51
Joined: Tue Jun 19, 2007 4:27 pm
Location: United Kingdom
Contact:

Get the entire address in the address bar in PHP

Post by madjamonline »

Hello all.
This is a very basic script I have put up and it does work.

Requirements:
Web server that supports PHP!

This is what you do:

Code: Select all

<?php
// Code by Jamie

if($_SERVER['QUERY_STRING'] == "")
{
$query_questionmark = "";
}
else
{
$query_questionmark = "?";
}
$pageaddress= "http://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'].$_SERVER['PHP_SELF'].$query_questionmark.$_SERVER['QUERY_STRING'];

// Done!
?> 
and the address will be stored in the var pageaddress.

If you enter the code above and want to write the page address on the page, add this underneath it.

Code: Select all

<?php
echo $pageaddress;
?>
: EDIT :
If however you want to remove certain bits in the code feel free to do so.


I hope the code is helpful!
Please give me comments!

Many thanks, :D
Post Reply