Forum Moderators: coopster

Message Too Old, No Replies

How do I use PHP for a mailing list?

         

mqw421

4:23 pm on Jul 6, 2005 (gmt 0)

10+ Year Member



Im using PHP to allow people to sign up for my mailing list on my site. I have everything set up but for some reason when I click the submit button the information is not being sent to my email address. Im not very good with PHP I just took some online tutorials and tried to figure it out. If you can tell me what I need to do that would be greatly appreciated. thanks

mqw421

4:29 pm on Jul 6, 2005 (gmt 0)

10+ Year Member



I need help with this code. Its not working. Please someone tell me why. It won't submit the information. Or maybe im just not sure how to retrieve it.

<form action="mail.php" method="post">
Your Name: <input type="text" name="name"><br>
E-mail: <input type="text" name = "email"><br><br>
<input type="submit" value="Submit">
</form>

<?
$name=$_POST['name'];
$email=$_POST['email'];
$comments=$_POST['comments'];
$to="support@example.com";
$message="$name just filled in your comments form. They said:\n$comments\n\nTheir e-mail address was: $email";
if(mail($to,"Comments From Your Site",$message,"From: $email\n")) {
echo "Thanks for your comments.";
} else {
echo "There was a problem sending the mail. Please check that you filled in the form correctly.";
}
?>

[edited by: jatar_k at 4:30 pm (utc) on July 6, 2005]
[edit reason] generalized email [/edit]