Abbster22
08-10-2010, 03:14 PM
I have a form that people are filling out to unsubscribe to a newsletter and I have the form figured out. But whenever I fill out the form and press the button to send the information to a specific e-mail, the page but the header on the web page is blank (or none of the echoing from the PHP shows up).
Here is the form code:
<form method="post" action="unsubscribe_submit.php">
<label for="firstname">First name:</label>
<input type="text" id="firstname" name="firstname" /><br />
<label for="lastname">Last name:</label>
<input type="text" id="lastname" name="lastname" /><br />
<label for="email">E-mail Address:</label>
<input type="text" id="email" name="email" /><br />
<input type="submit" value="Unsubscribe" name="submit" />
</form>
Here is the php code:
<?php
$name = $_POST['firstname'] . ' ' . $_POST['lastname'];
$email = $_POST['email'];
$to = "a.shipley22@gmail.com";
$subject = "User Unsubscribing From Newsletter";
$msg = "$name would like to unsubscribe from the electronic newsletter. $name's e-mail address is $email.";
if(mail($to, $subject, $msg, 'From: ' . $email)) {
echo("We are sorry to hear you are unsubscribing from our newsletter.\nWe hope that you continue to support SmileHealthy."); }
else { echo("Message unsuccessfully sent."); }
?>
Any help is appreciated. :)
Here is the form code:
<form method="post" action="unsubscribe_submit.php">
<label for="firstname">First name:</label>
<input type="text" id="firstname" name="firstname" /><br />
<label for="lastname">Last name:</label>
<input type="text" id="lastname" name="lastname" /><br />
<label for="email">E-mail Address:</label>
<input type="text" id="email" name="email" /><br />
<input type="submit" value="Unsubscribe" name="submit" />
</form>
Here is the php code:
<?php
$name = $_POST['firstname'] . ' ' . $_POST['lastname'];
$email = $_POST['email'];
$to = "a.shipley22@gmail.com";
$subject = "User Unsubscribing From Newsletter";
$msg = "$name would like to unsubscribe from the electronic newsletter. $name's e-mail address is $email.";
if(mail($to, $subject, $msg, 'From: ' . $email)) {
echo("We are sorry to hear you are unsubscribing from our newsletter.\nWe hope that you continue to support SmileHealthy."); }
else { echo("Message unsuccessfully sent."); }
?>
Any help is appreciated. :)