I want to create an 'Unsubscribe' link in the e-mails I'm sending out. If the person receiving the e-mail no longer wants to receive e-mails from me, they click the 'Unsubscribe' link in the e-mail which will be something like this:
http://www.mysite.com/unsub.php?email=user@msn.com
So upon click this link they will be taken to a page that says, do you wish to stop receiving these e-mails - Yes / No?
When the user clicks 'Yes', I need to save the e-mail address from the link in a text file.
At the moment I'm using the following php code on the page that the link takes the user to:
Code: Select all
<?php
$email = $_GET["email"];
$conn = fopen("emails.txt","a") or exit("Error In Opening The File!!");
fwrite($conn,$email."\n");
fclose($conn)
?>
The best way I can think of doing this is by making the link take the user to a page saying 'Unsubscribe? Yes / No' then when they click yes they are taken to another page which then has the code in above and saves the e-mail address when the page is opened.
My problem is, I don't know how to carry the e-mail address in the URL from one page to the next, can anyone help?
Thanks,
Laura