| | |
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 |
apache api array beginner binary body broken buttons cakephp checkbox class cms code cron curl database date date/time display dynamic ebooks echo email error file files folder form forms function functions global google href htaccess html image include insert ip javascript joomla limit link list login mail mediawiki menu mlm msqli_multi_query multiple mycodeisbad mysql number oop parameter paypal pdf php phpincludeissue problem query radio random recourse recursion regex remote script search seo server sessions sms source sp space speed sql static subdomain syntax system table tag tutorial update upload url validator variable vbulletin video web webdesign white wordpress xml youtube





