Hey back again
I’m trying to improve my news letter feature which allows people to register their emails, and as they do their emails get added to the database.
Whenever I send out a news letter using the mail() function, I want the message to include a link that will remove them from the db and therefore canceling their subscription.
The problem I’m having is that I’m not sure how to get the desired email…
[php]
include ‘core/init.php’;
include ‘includes/overall/header.php’;
$errors = array();
if(empty($_POST) === false) {
if(empty($_POST['message']) === true || empty($_POST['subject'])=== true) {
$errors[] = 'Both fields are required.';
} else {
$remove_email = ???
$query = "SELECT email FROM rss";
$emails = mysql_query($query) or die(mysql_error());
$subject = $_POST['subject'];
$message = $_POST['message'] . " \n \n To cancel your subscription, please follow this link. \n http://******.php?" .$remove_email;
while($rows = mysql_fetch_assoc($emails)) {
mail($rows['email'], $subject, $message, 'From: ****** - News Letter');
}
header('Location: new-rss.php?sent');
exit();
}
}
?>
[/php]
Any help is appreciated