nickalmand Posted August 19, 2009 Share Posted August 19, 2009 Okay, I'm new to these forums and I'm sure the answer to my question is a really simple one. Here's the deal, I'm trying to set up a page so that visitors can input their email, and submit it so they can get signed up for my church's e-newsletter. When I test it, it seems to work fine, but since posting it I keep getting emails from Apache (not the user) saying " would like to sign up for the eherald newsletter." It leaves the email address off. Maybe I'm doing something wrong with my email tag. Here's the code: <?php $email = $_POST['email']; $to = '[email protected]'; $subject = 'eherald signup'; $msg = "$email wants to sign up for the eherald newsletter."; mail($to, $subject, $msg, 'From:' . $email); echo 'You have been signed up for the e-herald newsletter.'; ?> I've got the page linked to the php just fine, but for some reason it's not including the email tag. Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/171001-getting-blank-email-from-apacheneed-help/ Share on other sites More sharing options...
mikesta707 Posted August 19, 2009 Share Posted August 19, 2009 echo the email variable, and the post variable before you execute the mail function. it seems like the post variable is empty. The form name may be slightly off (missing a capitalization or something) Quote Link to comment https://forums.phpfreaks.com/topic/171001-getting-blank-email-from-apacheneed-help/#findComment-901869 Share on other sites More sharing options...
nickalmand Posted August 19, 2009 Author Share Posted August 19, 2009 echo the email variable, and the post variable before you execute the mail function. it seems like the post variable is empty. The form name may be slightly off (missing a capitalization or something) So you mean that the echo should be something like: echo 'Congrats, $email. You have been signed up for the eherald.'; Not sure what you mean about echoing the post variable. I've checked the form name and it's right. Here's what's going on at the html side of things: <form id="form1" name="form1" method="post" action="signup.php"> <label for="email">E-mail:</label> <input type="text" name="email" id="email" /> <input type="submit" name="submit" id="submit" value="Sign me up!" /> </form> Quote Link to comment https://forums.phpfreaks.com/topic/171001-getting-blank-email-from-apacheneed-help/#findComment-901876 Share on other sites More sharing options...
mikesta707 Posted August 19, 2009 Share Posted August 19, 2009 after this line $email = $_POST['email']; write this echo $email . "<br />"; echo $_POST['email'] . "<br />"; Quote Link to comment https://forums.phpfreaks.com/topic/171001-getting-blank-email-from-apacheneed-help/#findComment-901879 Share on other sites More sharing options...
nickalmand Posted August 19, 2009 Author Share Posted August 19, 2009 Okay, I've stuck that little bit of code in. We'll see if it works. It worked in the test, but then again, it did before also. I'm surprised to hear that an echo command could be causing the problem. I figured it might have been something wrong with the version of php I'm using. I guess we'll see. Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/171001-getting-blank-email-from-apacheneed-help/#findComment-901887 Share on other sites More sharing options...
mikesta707 Posted August 19, 2009 Share Posted August 19, 2009 The echo wouldn't be causing the problem, its just a test to make sure that the variable is being populated with data as you expect it to be. Assuming that you have SMTP installed correctly on your server, and you aren't getting any error messages, your script should work. Quote Link to comment https://forums.phpfreaks.com/topic/171001-getting-blank-email-from-apacheneed-help/#findComment-901893 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.