php contact form inside of an email blast
Posted: Sun Feb 20, 2011 1:07 pm
Hey guys, new to php and very new to this forum but I'm looking for some help. I am trying to create a contact form inside of an email blast that I am going to be sending out. I have created my html page and have it ready to go through yesmail direct. The script that I have now for the form works great when viewed on my actual html page. The problem is when I upload it through the email, it doesnt work or send anything. There is an else statement that is on the script that basically is I guess for when the person hits submit but they didnt actually hit submit from the html page like the case of hitting submit through your email client. I just dont understand what part of the script I need to change for the script to work from your email as well. Could anybody look at this and see if they know where the problem is please? Basically the only difference between hitting submit through the html page is you recieve the "Data has been submitted to..." output and just straight from the email you get the elses "blarg" output. I would be fine with that I would just change the literature on the "blarg" part but when you get the "blarg" one, the information is not sent to my email like I want it to. PLEASE HELP!!! Thank you in advance.
<?php
if(isset($_POST['submit'])) {
$to = "garyupham@gmail.com";
$subject = "How to Contact Me";
$number_field = $_POST['number'];
$email_field = $_POST['email'];
$message = $_POST['message'];
$option = $_POST['radio'];
$facebook_field =$_POST['facebook'];
$twitter_field =$_POST['twitter'];
$body = "$check_msg How to best contact me: $option\n Phone Number: $number_field\n Facebook Address: $facebook_field\n Twitter Account: $twitter_field";
echo "Data has been submitted to $to!";
mail($to, $subject, $body);
} else {
echo "blarg!";
}
?>
<?php
if(isset($_POST['submit'])) {
$to = "garyupham@gmail.com";
$subject = "How to Contact Me";
$number_field = $_POST['number'];
$email_field = $_POST['email'];
$message = $_POST['message'];
$option = $_POST['radio'];
$facebook_field =$_POST['facebook'];
$twitter_field =$_POST['twitter'];
$body = "$check_msg How to best contact me: $option\n Phone Number: $number_field\n Facebook Address: $facebook_field\n Twitter Account: $twitter_field";
echo "Data has been submitted to $to!";
mail($to, $subject, $body);
} else {
echo "blarg!";
}
?>