How to grab the page url in an email form?
I'm working on a site with an email form on each page, if possible, I would like it to automatically grab and send the page url to the email address which the form directs to (as a part of the message). Is there any way to do this?
If what you are saying is you want the url of the page from which you are gathering the email info from and from which you end up sending the mail, then I think you mean to use $_SERVER['PHP_SELF'].
Try out with the below code:
<form name="myform" action="<?=$_SERVER['PHP_SELF']. "?" . $_SERVER['QUERY_STRING'];?>" method="GET">
or could you echo $location; die; after this line:
$location = $_GET['current_url'];
Hope this helps.
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)