I have written a contact form in Dreamweaver and embedded it in Adobe Muse. Problem is that the form sends an email OK, but with blank fields, just the headings. It's probably a problem with my code, as I'm a relative noob with HTML and even more so with PHP. The PHP script was originally downloaded from 123reg, as that is where the website is hosted. Obvs I've tweaked it to suit. I've looked at other posts with similar problems but nothing has worked.`
The form seems to work ok, so maybe I can start with the PHP.
<?php
$EmailFrom = "sales#trisomet.com";
$EmailTo = "sales#hairwraps.co.uk";
$Subject = "QuikQuote Web Enquiry";
$name = trim(stripslashes($_POST['Name']));
$email = trim(stripslashes($_POST['Email']));
$tel = trim(stripslashes($_POST['Tel']));
$textfield2 = trim(stripslashes($_POST['Postcode']));
$textarea = trim(stripslashes($_POST['Message']));
$RoofType = trim(stripslashes($_POST['Roof Type']));
$number = trim(stripslashes($_POST['Roof Length']));
$number2 = trim(stripslashes($_POST['Roof Width']));
$RadioGroup1 = trim(stripslashes($_POST['Fixings']));
$Flashing = Trim(stripslashes($_POST['Flashings']));
$panels = trim(stripslashes($_POST['Clear Panels']));
$number3 = trim(stripslashes($_POST['Quantity']));
$number4 = trim(stripslashes($_POST['Length']));
// validation
$validationOK=true;
if (!$validationOK) {
print "<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">";
exit;
}
// prepare email body text
$Body = "";
$Body .= "Name: ";
$Body .= $name;
$Body .= "\n";
$Body .= "Email: ";
$Body .= $email;
$Body .= "\n";
$Body .= "Tel: ";
$Body .= $tel;
$Body .= "\n";
$Body .= "Postcode: ";
$Body .= $textfield2;
$Body .= "\n";
$Body .= "Message: ";
$Body .= $textarea;
$Body .= "\n";
$Body .= "Roof Type: ";
$Body .= $RoofType;
$Body .= "\n";
$Body .= "Roof Length: ";
$Body .= $number;
$Body .= "\n";
$Body .= "Roof Width: ";
$Body .= $number2;
$Body .= "\n";
$Body .= "Fixings: ";
$Body .= $RadioGroup1;
$Body .= "\n";
$Body .= "Flashing: ";
$Body .= $Flashing;
$Body .= "\n";
$Body .= "Clear Panels: ";
$Body .= $panels;
$Body .= "\n";
$Body .= "Quantity: ";
$Body .= $number3;
$Body .= "\n";
$Body .= "Length (m): ";
$Body .= $number4;
$Body .= "\n";
// send email
$success = mail($EmailTo, $Subject, $Body, "From: $EmailFrom");
// redirect to success page
if ($success){
print "<meta http-equiv=\"refresh\" content=\"1;URL=index.html\">";
}
else{
print "<meta http-equiv=\"refresh\" content=\"1;URL=error.html\">";
}
?>
Does anything look obviously wrong?
I think my HTML declaration is ok -
<form action="contactform.php" method="post" class="form">
Any help would be fantastic as it's doing my nut in!!
here's the html
<div id="formWrapper">
<form action="contactform.php" method="post" class="form">
<div class="container" style="width: 100%; ">
<div class="sidebar" style="width: 365px; height:255px; margin-left:10px; float: left; ">
<label for="textfield"><strong>Name</strong>:</label>
<input name="textfield" type="text" required id="textfield" size="40">
</p><br>
<p>
<label for="email"><strong>Email:</strong></label>
<input name="email" type="email" required id="email" size="40">
</p><br>
<p>
<label for="tel"><strong>Telephone: </strong></label>
<input name="tel" type="tel" required id="tel" size="40">
</p><br><p>
<label for="textfield2"><strong>Postcode:</strong></label>
<input name="textfield2" type="text" required id="textfield2">
</p>
</div>
<div class="content" style="width:365px; height: 255px; float:right; margin-right:10px;">
<label for="textarea"><strong>Message:</strong></label>
<strong>
<textarea name="textarea" rows="13" cols="40"></textarea>
</strong></p>
</div>
</div>
<div class="content3" style="width: 220px; height:110px; margin-left:10px; float: left;">
<label for="Roof Type"><strong>Roof Type: </label>
</strong>
<label>
<input name="Roof Type" type="radio" required id="RoofType_0" title="Roof Type" value="Single Slope">
Single Slope</label>
<label>
<input type="radio" name="Roof Type" value="Symmetrical Apex" id="RoofType_1">
Symmetrical Apex</label>
<label>
<input type="radio" name="Roof Type" value="Asymmetrical Apex" id="RoofType_2">
Asymmetrical Apex</label>
</div>
<div class="content4" style="width: 215px; height: 110px; float:left; ">
<label for="number"><strong>Roof Length (m):</strong></label>
<input name="number" type="number" required id="number">
<label for="number2"><strong>Roof Width (m):</strong></label>
<input name="number2" type="number" required id="number2">
</div>
<div class="content5" style="width:210px; height: 110px; float:left; ">
<label><strong>Fixings:</strong><br>
<input name="RadioGroup1" type="radio" required id="RadioGroup1_0" value="Timber">
Timber</label>
<label>
<input type="radio" name="RadioGroup1" value="Light Section Steel" id="RadioGroup1_1">
Light Section Steel</label>
<label>
<input type="radio" name="RadioGroup1" value="Heavy Section Steel" id="RadioGroup1_2">
Heavy Section Steel</label>
</div>
<div class="content6" style="width:85px; height: 110px;float:left; ">
<strong>Flashing:
</strong>
<label>
<input name="Flashing" type="radio" required id="Flashing_0" value="Yes">
Yes</label>
<label>
<input type="radio" name="Flashing" value="No" id="Flashing_1">
No</label>
</div>
<div class="content7" style="width:150px; margin-left: 10px; height: 90px; float:left; ">
<label for "panels" style="font-weight:bold">Clear Panels:</strong></label>
<label>
<input name="panels" type="radio" required id="panels_0" value="Yes">
Yes</label>
<label>
<input type="radio" name="panels" value="No" id="panels_1">
No</label>
</div>
<div class="content8" style="width:100px; height: 110px; float:left;">
<label for="number3"><strong>Quantity:</strong></label>
<input name="number3" type="number" required id="number3" style="width:80px" value="0">
</div>
<div class="content9" style="width:150px; height:110px;float:left;">
<label for="number4"><strong>Length (m):</label>
<input name="number4" type="number" required id="number4" style="width:80px" value="0">
</div>
<div class="submitb" style="width:190px; height:110px; float:left; ">
<p>
<input type="submit" name="submit" id="submit" value="Get A Quote >">
</p>
</div>
</form></div>
I seem to have solved my own problem. I thought the top $POST fields were the field headings for the emails, whereas they are actually the field names from my form. DUH!!!!!
Related
I have a checkbox that confirms if the sender wants the copy of the form to his/her email. Now, how can I have get it to work with PHP?
I have the following HTML form code. "sendcopy checkbox" shows the bottom of this code:
<form id="contact-form" action="send_form.php" method="post">
<input type="hidden" name="recipient" value="myemail#domain.net">
<input type="hidden" name="inhtml" value="yes">
<div class="contact-row">
<div style="float: left; width: 34%;">
<input class="contact-input" style="width: 300px;" name="name" placeholder="Name*" required><br>
</div>
<div style="float: left; width: 33%;">
<input class="contact-input" style="width: 290px;" name="email" placeholder="Email" type="email"><br>
</div>
<div style="float: right; width: 33%;">
<input class="contact-input" style="width: 305px;" name="subject" placeholder="Subject*" required><br>
</div>
</div>
<br>
<br>
<br>
<div class="contact-row">
<textarea cols="173" rows="10" name="message" placeholder="Message*" required></textarea><br>
</div>
<br>
<label>
<input type="checkbox" name="sendcopy" value="Yes" checked/>Send copy to your mail
</label>
<br>
<div class="confirm">
<label>
<input type="checkbox" name="confirm" required>
Confirm that you are people.
</label>
</div>
<br>
<br>
<div class="contact-row">
<div class="contact-row">
<center>
<input id="contact-submit" type="image" src="submit.png" alt="Send" />
</center>
</div>
</div>
</form>
And my PHP code:
<?php
$recipient = $_POST["recipient"];
$subject = $_POST["subject"];
$inhtml = $_POST["inhtml"];
$email = $_POST["email"];
$name = $_POST["name"];
$message = $_POST["message"];
$sendCopy = isset($_POST['sendcopy'];
$charset = 'utf-8';
$head =
"From: $email \r\n" .
"MIME-Version: 1.0\r\n" .
"Content-Type: text/html; charset=$charset\r\n" .
"Content-Transfer-Encoding: 8bit";
$body = '';
if ($inhtml == 'yes') {
$body = '<html><body style="font-family: Arial; color: #727272;">';
$body = $body . '<h3 style="font-size: 16px;">Name: ' . $name . '</h3>';
$body = $body . '<h4 style="font-size: 14px;">Subject: ' . $subject . ' (' . $email . ') </h4>';
$body = $body . '<p style="font-size: 13px;">' . $message . '</p>';
$body = $body . '</body></html>';
}
else {
$body = $body . 'Name: ' . $name . '
Subject: ' . $name . ' (' . $email . ')
Message:
' . $message;
}
if (mail($recipient, "=?$charset?B?" . base64_encode($subject) . "?=", $body, $head)) {
if ($sendCopy) {
$sentToSender = mail($email, "=?$charset?B?" . base64_encode($subject) . "?=", $body, $head);
}
header("Location: ../form-success.htm");
exit;
}
else {
header("Location: ../form-error.htm");
exit;
}
?>
First, check if the "sendcopy" checkbox is checked:
$sendCopy = isset($_POST['sendcopy']);
You don't have to check its value. The frontend simply won't send anything if the checkbox is not checked, so if it exists in the $_POST array, that means the user has checked it.
Next, just send the exact same mail to the sender's email address:
if ($sendCopy) {
$sentToSender = mail($email, "=?$charset?B?" . base64_encode($subject) . "?=", $body, $head);
}
You can add this code just before redirecting your user to the success page.
The missing parentheses have now been added to the code above, so it works well.
The Contact page which has form submission, https://photos.app.goo.gl/GpbWvks2Y3SjwmX58 is not being executed. I tried various solutions from other questions that's already been asked but had no luck.
The .php file is in the Contacts folder along with the Contacts/index.html page.
Some expert help would be much appreciated.
Here's the Javascript on the HTML page.
<script type="text/javascript">document.getElementById('spc').value = '755fd9ccedf916b2cd08bb7be88691dd';</script>
<form name="enquiry" method="post" action="infosemantic-enquiryform1.php" class="form" id="form">
<p class="input_field">
<label class="field">First Name:</label>
<input name="name" type="text" class="name_box" id="name" value="" size="35">
</p>
<p class="input_field">
<label class="field">Last Name:</label>
<input name="lastname" type="text" class="name_box" id="lastname" value="" size="35">
</p>
<p class="input_field">
<label class="field">Title:</label>
<input name="title" type="text" class="name_box" id="title" value="" size="35">
</p>
<p class="input_field">
<label class="field">Company:</label>
<input value="" name="company" class="name_box" size="35" type="text">
</p>
<p class="input_field">
<label class="field">E-mail Address:</label>
<input name="email" type="text" class="name_box" id="email" value="" size="35">
</p>
<p class="input_field">
<label class="field">Message:</label>
<textarea name="Message" id="csinbr" cols="45" rows="5" class="name_box2" w></textarea>
</p>
<p class="btn"><input name="Subject" value="Enquiry from DSR Power" type="hidden">
<input name="Submit" value="Submit " class="sbm" type="submit">
<input name="Reset" value="Clear Form" class="sbm" type="reset">
</p>
<font face="Verdana" size="2">
<font face="Verdana" size="2">
<input name="form_name" value="rajforever2" type="hidden">
</font>
<input name="userid" value="webindia" type="hidden">
</font>
</form>
</div>
$message = "<html><body><table align='center' boarder='1' cellpadding='5' cellspacing='2' style='font-family:Verdana, Arial, Helvetica, sans-serif;font-size:12px;font-weight:bold;background-color:#CCCCFF;color:#000000;;border:double'>";
$message .= "<tr><td align='left'><b> Name </b></td><td>:</td><td>".$_POST['name']."</td></tr>";
$message .= "<tr><td align='left'><b>Last Name </b></td><td>:</td><td>".$_POST['lastname']."</td></tr>";
$message .= "<tr><td align='left'><b>Title </b></td><td>:</td><td>".$_POST['title']."</td></tr>";
$message .= "<tr><td align='left'><b>Company </b></td><td>:</td><td>".$_POST['company']."</td></tr>";
$message .= "<tr><td align='left'><b>Email </b></td><td>:</td><td>".$_POST['email']."</td></tr>";
$message .= "<tr><td align='left'><b>Message</b></td><td>:</td><td>".$_POST['Message']."</td></tr>";
$message .= "</table></body></html>";
/*to avoid spam mails in contact form*/
// Select if you want to check form for standard spam text
$SpamCheck = "Y"; // Y or N
$SpamReplaceText = "*content removed*";
// Error message prited if spam form attack found
$SpamErrorMessage = "<p align=\"center\"><font color=\"red\">Malicious code content detected.</font><br><b>Your IP Number of <b>".
getenv("REMOTE_ADDR").
"</b> has been logged.</b></p>";
$name = $_POST['name'];
$email = $_POST['email'];
$msg = $_POST['comments'];
if ($SpamCheck == "Y") {
// Check for Website URL's in the form input boxes as if we block website URLs from the form,
// then this will stop the spammers wastignt ime sending emails
if (preg_match("/http/i", "$name")) {
echo "$SpamErrorMessage";
exit();
}
if (preg_match("/http/i", "$email")) {
echo "$SpamErrorMessage";
exit();
}
if (preg_match("/http/i", "$msg")) {
echo "$SpamErrorMessage";
exit();
}
// Patterm match search to strip out the invalid charcaters, this prevents the mail injection spammer
$pattern = '/(;|\||`|>|<|&|^|"|'."\n|\r|'".'|{|}|[|]|\)|\()/i'; // build the pattern match string
$name = preg_replace($pattern, "", $name);
$email = preg_replace($pattern, "", $email);
$msg = preg_replace($pattern, "", $msg);
// Check for the injected headers from the spammer attempt
// This will replace the injection attempt text with the string you have set in the above config section
$find = ["/bcc\:/i", "/Content\-Type\:/i", "/cc\:/i", "/to\:/i"];
$email = preg_replace($find, "$SpamReplaceText", $email);
$name = preg_replace($find, "$SpamReplaceText", $name);
$msg = preg_replace($find, "$SpamReplaceText", $msg);
// Check to see if the fields contain any content we want to ban
if (stristr($name, $SpamReplaceText) !== false) {
echo "$SpamErrorMessage";
exit();
}
if (stristr($msg, $SpamReplaceText) !== false) {
echo "$SpamErrorMessage";
exit();
}
// Do a check on the send email and subject text
if (stristr($to, $SpamReplaceText) !== false) {
echo "$SpamErrorMessage";
exit();
}
if (stristr($subject, $SpamReplaceText) !== false) {
echo "$SpamErrorMessage";
exit();
}
}
/*End*/
$headers = "From: $_POST[email]"."\r\n";
$headers .= 'Bcc:bharath#briofactors.com'."\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1; format=flowed\n';
$headers .= "MIME-Version: 1.0\n";
$headers .= "Content-Transfer-Encoding: 8bit\n";
$headers .= "X-Mailer: PHP\n";
if (mail($to, $subject, $message, $headers)) {
header("location:thanks.html");
}
I have the below html form, which when the user clicks submit, it fires the php code in contactengine.php but the values are missing from the email I get and the .txt form that is generated.
<!------------------from start------------>
<form method="POST" action="contactengine.php" class="form-inline" >
<div class="form-group">
<label>Full Name*</label><br>
<input name="full_name" type="text" class="form-control" placeholder="Full Name" id="full_name" required>
</div>
<div class="form-group">
<label>Telephone *</label><br>
<input name="contact_tel" type="text" class="form-control" placeholder="Telephone" id="contact_tel" required>
</div>
<div class="form-group">
<label>Email *</label><br>
<input name="contact_email" type="email" class="form-control" placeholder="Email Address" id="contact_email" required>
</div>
<div class="form-group">
<label>Subject of Enquiry *</label><br>
<select name="sub_enquiry" class="form-control" id="sub_enquiry">
<option value="Assesments" >Assesments</option><option value="Services" >Services</option>
<option value="Inpections" >Inpections</option>
<option value="Other" >Other</option>
</select>
</div><br> <br>
<label>Your message *</label><br>
<textarea name="contact_msg" class="form-control" rows="5" id="contact_msg" required ></textarea> <br >
<br >
<button type="submit" class="btn btn-purple" ><span class="glyphicon glyphicon-envelope"></span> Submit</button>
</form>
<!----------------------php form------------------>
<?php
$to = "xxxx#gmail.com";
$Subject = "OFSUK.ORG";
$full_name = $_POST['full_name'];
$contact_email = $_POST['contact_email'];
$contact_tel = $_POST['contact_tel'];
$sub_enquiry = $_POST['sub_enquiry'];
$contact_msg = $_POST['contact_msg'];
// validation
$validationOK=true;
if (!$validationOK) {
header("location:/error.php");
exit;
}
// prepare email body text
$Body = "";
$Body .= "\n";
$Body .= "Name: ";
$Body .= $full_name;
$Body .= "\n";
$Body .= "Email: ";
$Body .= $contact_email;
$Body .= "\n";
$Body .= "Telephone: ";
$Body .= $contact_tel;
$Body .= "\n";
$Body .= "Enquiry: ";
$Body .= $sub_enquiry;
$Body .= "\n";
$Body .= "Message: ";
$Body .= $contact_msg;
$Body .= "\n";
// send email
$success = mail($to, $Subject, $Body);
$email_from = $full_name.'<'.$email_from.'>';
$myfile = fopen("emails.txt", "a") or die("Unable to open file!");
$txt = $Body;
fwrite($myfile, "\n". $txt);
fclose($myfile);
// redirect to success page
if ($success){
header("location:/");
}
else{
header("location:/contact-us.php");
}
?>
These two are stored in two locations but are working fine am just not getting any data.
Change <button type="submit" class="btn-purple"/>
To
<input type="submit" name="sbmt" class="btn-purple"/>
And then validate if sbmt has been set, if so print out the values
Try to use
pg_escape_string
like...
pg_escape_string($_POST['full_name']);
... to fix data passing problems.
so i finally got my feedback form to be working and sending emails to my email address but i have another problem. The content of the forms are not showing, don't know what is wrong. I'm new to php tho so i'm very sure its simple.. posted the code below
<?php
$name = $_POST ['name'];
$mail = $_POST ['mail'];
$number = $_POST ['number'];
$feedback = $_POST ['feedback'];
$to = 'ATotallyRandom#Email.net';
$subject = 'Feedback from atetaconsult.com';
$msg = "Your name: $name\n" .
" Your email: $email\n" .
" Feedback: $feedback\n";
mail ($to, $subject, $msg, 'From:' . $email);
echo ' thank you <br/>';
echo ' your name ' .$name .'<br/>';
echo ' Your email ' . $email .'<br/>';
echo ' Your feedback ' . $feedback . '<br/>';
?>
The HTML code for the form is below too
<form method="post" action="send.php">
<p class="head" style="font-style: italic; color: #fff; line-height: 24px; font-size: 19px; margin-bottom: 47px; margin-top: 20px; font-family: Lato, sans-serif;">
We’d love to hear from you. Interested in working together? Fill out the form below with some info about your project and I will get back to you as soon as I can. Please allow a couple days for me to respond.</p>
<div class="row form">
<input id="name" class="name" type="text" placeholder="Name">
<input id="mail" class="mail" type="text" placeholder="Email">
<input id="number" class="phone" type="text" placeholder="Phone">
</div>
<div class="span6 box box_r">
<textarea id="feedback" rows="6" class="span6" placeholder="Type a message here..."></textarea>
</div>
<div class="btn" style="margin-top:5px;">
<input type="submit" value="Send your message">
</div>
</form><div style="clear: both;"></div>
Here:
$msg = "Your name: $name\n" .
" Your email: $email\n" .
" Feedback: $feedback\n";
you are asking for the variable $email
but you have specified it as $mail at the top.
See: http://markpetherbridge.co.uk/StackOverflow/phpmail.php?name=Mark&mail=test#test.com&feedback=testfeedback
I have changed it to $email and the type to $_GET for demonstration purposes, but it seems to be working. Try that.
Here is the Full code for the file:
<?php
$name = $_GET ['name'];
$email = $_GET ['mail'];
$number = $_GET ['number'];
$feedback = $_GET ['feedback'];
$to = 'ATotallyRandom#Email.net';
$subject = 'Test from Mark P';
$msg = "Your name: $name\n";
$msg .= " Your email: $email\n";
$msg .= " Feedback: $feedback\n";
mail ($to, $subject, $msg, 'From:' . $email);
echo ' thank you <br/>';
echo ' your name ' .$name .'<br/>';
echo ' Your email ' . $email .'<br/>';
echo ' Your feedback ' . $feedback . '<br/>';
?>
<br /><br />
Here is the result from $msg: <br /><br />
<?php
echo $msg;
?>
You need to add name into your html:
<input name="name" id="name" class="name" type="text" placeholder="Name">
<input name="mail" id="mail" class="mail" type="text" placeholder="Email">
<input name="number" id="number" class="phone" type="text" placeholder="Phone">
Put all these code in between:
if($_POST){
// Your coding
}
Also show me the Javascript/Jquery coding you are using on contact form.
You haven't set a name value on the input.
Change in:
<form method="post" action="send.php">
<p class="head" style="font-style: italic; color: #fff; line-height: 24px; font-size: 19px; margin-bottom: 47px; margin-top: 20px; font-family: Lato, sans-serif;">
We’d love to hear from you. Interested in working together? Fill out the form below with some info about your project and I will get back to you as soon as I can. Please allow a couple days for me to respond.</p>
<div class="row form">
<input name="name" id="name" class="name" type="text" placeholder="Name">
<input name="mail" id="mail" class="mail" type="text" placeholder="Email">
<input name="number" id="number" class="phone" type="text" placeholder="Phone">
</div>
<div class="span6 box box_r">
<textarea name="feedback" id="feedback" rows="6" class="span6" placeholder="Type a message here..."></textarea>
</div>
<div class="btn" style="margin-top:5px;">
<input type="submit" value="Send your message">
</div>
</form><div style="clear: both;"></div>
I can not get my form to send the email to me through my host server. I have run an error check using:
error_reporting( -1 );
ini_set( 'display_errors',1 );
and:
if($success){
print "EmailTo: $EmailTo<br>".
"Subject: $Subject<br>".
"Body: $Message<br>".
"From: $EmailFrom";
}
and returned the correct information.
My Code:
PHP:
<?php
$EmailFrom = Trim(stripslashes($_POST['Email']));
$EmailTo = "mclaypool#mac-av.com";
$Subject = "MAC Website Contact Form";
$Name = Trim(stripslashes($_POST['Name']));
$Address1 = Trim(stripslashes($_POST['Address1']));
$Address2 = Trim(stripslashes($_POST['Address2']));
$City = Trim(stripslashes($_POST['City']));
$State = Trim(stripslashes($_POST['State']));
$Zip = Trim(stripslashes($_POST['Zip']));
$Country = Trim(stripslashes($_POST['Country']));
$Email = Trim(stripslashes($_POST['Email']));
$Phone = Trim(stripslashes($_POST['Phone']));
$Message = Trim(stripslashes($_POST['Message']));
// validation
$validationOK=true;
if (!$validationOK) {
print "<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">";
exit;
}
// prepare email body text
$Body = "";
$Body .= "Name: ";
$Body .= $Name;
$Body .= "\n";
$Body .= "Address1: ";
$Body .= $Address1;
$Body .= "\n";
$Body .= "Address2: ";
$Body .= $Address2;
$Body .= "\n";
$Body .= "City: ";
$Body .= $City;
$Body .= "\n";
$Body .= "State: ";
$Body .= $State;
$Body .= "\n";
$Body .= "Zip: ";
$Body .= $Zip;
$Body .= "\n";
$Body .= "Country: ";
$Body .= $Country;
$Body .= "\n";
$Body .= "Email: ";
$Body .= $Email;
$Body .= "\n";
$Body .= "Phone: ";
$Body .= $Phone;
$Body .= "\n";
$Body .= "Message: ";
$Body .= $Message;
$Body .= "\n";
// send email
$success = mail($EmailTo, $Subject, $Body, "From: <$EmailFrom>\r\n");
// redirect to success page
if ($success){
print "<meta http-equiv=\"refresh\" content=\"0;URL=contactthanks.php\">";
}
else{
print "<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">";
}
?>
HTML:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>MAC Production Contact Form</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="stylesheet" type="text/css" href="css/form.css" />
</head>
<body>
<div id="page-wrap">
<img src="images/title.gif" alt="A Nice & Simple Contact Form" /><br /><br />
<p>Please fill in the following fields and we will get back to.</p>
<div id="contact-area">
<form method="post" action="contactengine.php">
<label for="Name">Name:</label>
<input type="text" name="Name" id="Name" />
<label for="Address1">Address</label>
<input type="text" name="Address1" id="Address1" />
<label for="Address2"></label>
<input type="text" name="Address2" id="Address2" />
<label for="City">City:</label>
<input type="text" name="City" id="City" />
<label for="State">State:</label>
<input type="text" name="State" id="State" />
<label for="Zip">Zip/Postal Code:</label>
<input type="text" name="Zip" id="Zip" />
<label for="Country">Country:</label>
<input type="text" name="Country" id="Country" />
<label for="Email">Email:</label>
<input type="text" name="Email" id="Email" />
<label for="Phone">Phone Number:</label>
<input type="text" name="Phone" id="Phone" />
<label for="Message">Message:</label><br />
<textarea name="Message" rows="20" cols="20" id="Message"></textarea>
<input type="submit" name="submit" value="Submit" class="submit-button" />
</form>
<div style="clear: both;"></div>
<p> </p>
</div>
</div>
The emails are not getting marked as spam. The form worked on the server when I originally created the website and sent emails without any issues. The host changed their webserver and I am assuming this is what is causing the problem, but want to make sure before I get angry with them. I have 2 forms setup on the server one is the one listed by the code entered and the other has the error reporting inserted. The 2 links are at:
http://www.mac-av.com/form/
http://www.mac-av.com/form/index_test.html
Is the email_from address getting stored correctly in database? I have had issues with this in the past where the "-" doesn't get stored.. i.e. mclaypool#mac-av.com