| | |
Display URL
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
PHP Syntax (Toggle Plain Text)
$url = "http://".$_SERVER['HTTP_HOST'].$_SERVER['SCRIPT_NAME']; echo $url
ok then well theres two ways to do this then...
this will always assume there is arguments in the address so u will always see a question mark int the address, a better way of doing this would be to test if there actually was any arguments before just adding the question mark such as in this example:
i hope this answers any questions you do have
PHP Syntax (Toggle Plain Text)
$url = "http://".$_SERVER['HTTP_HOST'].$_SERVER['SCRIPT_NAME']."?".$_SERVER['QUERY_STRING']; echo $url;
this will always assume there is arguments in the address so u will always see a question mark int the address, a better way of doing this would be to test if there actually was any arguments before just adding the question mark such as in this example:
PHP Syntax (Toggle Plain Text)
$url = "http://".$_SERVER['HTTP_HOST'].$_SERVER['SCRIPT_NAME']; if (!empty($_SERVER["QUERY_STRING"])) $url .= "?".$_SERVER['QUERY_STRING']; echo $url;
i hope this answers any questions you do have
:eek:paradox814, you beet me tothe answer again. Good job m8!:p vbmenu_register("postmenu_82884", true);
dynastyCODERS#1 when it comes to Programming Tutorials, Database designs and discussions, Operating Systems, you name it, check us out and drop us a line to tell us your opinions on any and everything in mind!;)
hey i just rememberd one case in which this won't work!!!
if you are usign a secure ssl http session... in which case replace http:// with https:// (notice the s)
ok man, peace out
if you are usign a secure ssl http session... in which case replace http:// with https:// (notice the s)
ok man, peace out
![]() |
Similar Threads
- Display URL from another traget (JavaScript / DHTML / AJAX)
- Display URL from another traget (php) (PHP)
- Variables in the URL - and how to get them (HTML and CSS)
- setting variable using url (JavaScript / DHTML / AJAX)
- setting variable using url (ASP)
Other Threads in the PHP Forum
- Previous Thread: Passing variables into form fields
- Next Thread: Turck mmCache no more?
| Thread Tools | Search this Thread |
.htaccess ajax apache api array beginner beneath binary broadband broken button cakephp checkbox class cms code countingeverycharactersfromastring crack cron curl database date decode display dynamic echo email error file files folder form forms function functions google href htaccess html image include insert integration ip java javascript joomla limit link login loop mail match menu mlm mod_rewrite multiple mysql oop paypal pdf php problem protocol query radio random recursion regex remote script search server sessions sms smtp soap source space sql strip_tags survey syntax system table tutorial undefined update upload url validation validator variable video virus votedown web window.onbeforeunload=closeme; xml youtube





