I want to create an "Email this Page"
The idea is to have the user input his/her email address and click the submit button. By using the mail() function, I will send the URL of this page to the email address submitted by the user.
But my question is that how to obtain the URL of each page? I know in ColdFusion we can use pageinfo.URL, but how to get this one in PHP?
The global variable $PHP_SELF returns the current URL you are at (minus any $_GET[] variables attached, atleast I've had problems with them).
Hi, thanks for reminding that I can use PHP_SELF.
If get won't work for you (at least did not work for me.), try this:
$URL=$_SERVER['PHP_SELF'];
This will give you URL of your page.
I'm sorry, I didn't explain the problem I was having. I meant that I was not getting anything after the question mark in the URL.
Not sure if your problem is like this?
anyfile.php?id=12
You cannot get the id=12 part?
I had the same problem. Then I used $_GET["id"] to get the id and add it after the question mark.
yeah, i understand, i just meant that the $PHP_SELF by itself did not return that. thanks anyway