/ Published in: PHP
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
$a = $_SERVER['HTTP_HOST'] // server-name - domain $b = $_SERVER['PHP_SELF'] // you're page, as you know $c = $_SERVER['QUERY_STRING'] // everything after the "?", // but not including the "?" echo "$a$b?$c"; // would print whole URL $d = $_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF']."?".$_SERVER['QUERY_STRING']; // notice the "?" in middle of the above, and variables seprated by dots(.) // $_SERVER['QUERY_STRING'] reads url GET query, but does not contain // the "?" in it itself, since "?" is not a variable. echo $d; // would print the whole URL using above.