This question already has answers here:
PHP mail function doesn't complete sending of e-mail
(31 answers)
Closed 7 years ago.
My mailer form isn't works. If it possible please take a look and give me some answer to make it work. <3
Here is the PHP:
<?php
if($_POST) {
$EmailFrom = "blah";
$EmailTo = "blah";
$Subject = "blah";
$Name1 = $_POST['Name1'];
$Name2= $_POST['Name2'];
$Name3 = $_POST['Name3'];
$Name4 = $_POST['Name4'];
$Name5 = $_POST['Name5'];
$Email = $_POST['Email'];
$TeamName = $_POST['TeamName'];
$Message = $_POST['Message'];
$Body = "";
$Body .= "\n";
$Body .= "Email: ";
$Body .= $Email;
$Body .= "\n";
$Body .= "Player1: ";
$Body .= $Name1;
$Body .= "\n";
$Body .= "Player2: ";
$Body .= $Name2;
$Body .= "\n";
$Body .= "Player3: ";
$Body .= $Name3;
$Body .= "\n";
$Body .= "Player4: ";
$Body .= $Name4;
$Body .= "\n";
$Body .= "Player5: ";
$Body .= $Name5;
$Body .= "\n";
$Body .= "TeamName: ";
$Body .= $TeamName;
$Body .= "\n";
$Body .= "Megjegyzes: ";
$Body .= $Message;
$Body .= "\n";
$success = mail($EmailTo, $Subject, $Body, "From: <$EmailFrom>");
}
?>
I tried many methods but seems like I don't really know something.
In HTMLI used this method:
Here is the HTML:
<form action="contact.php" class="contact-form" method="post">
<div class="row">
<div class="col-md-6">
<input type="text" name="Name1" class="form-control" id="name1" placeholder="Játékos 1">
<input type="text" name="Name2" class="form-control" id="name2" placeholder="Játékos 2">
<input type="text" name="Name3" class="form-control" id="name3" placeholder="Játékos 3">
<input type="text" name="Name4" class="form-control" id="name4" placeholder="Játékos 4">
<input type="text" name="Name5" class="form-control" id="name5" placeholder="Játékos 5">
<p> Még <strong> 16 </strong> csapat számára van hely! </p>
</div>
<div class="col-md-6">
<input type="email" name="Email" class="form-control" id="Email" placeholder="Email">
<input type="text" name="TeamName" class="form-control" id="TeamName" placeholder="Csapatnév">
<textarea class="form-control" id="Message" rows="25" cols="10" placeholder=" Megjegyzés (nem kötelező)"></textarea>
<button type="button" class="btn btn-default submit-btn form_submit">Jelentkezés</button>
<p> A jelentkezéssel elfogadjátok a verseny szabályzatát és feltételeit. </p>
</div>
</div>
</form>
What can be wrong? Thanks for your reply!
<?php
if(isset($_POST["submit"])) {
$EmailFrom = "blah";
$EmailTo = "blah";
$Subject = "blah";
$Name1 = $_POST['Name1'];
$Name2= $_POST['Name2'];
$Name3 = $_POST['Name3'];
$Name4 = $_POST['Name4'];
$Name5 = $_POST['Name5'];
$Email = $_POST['Email'];
$TeamName = $_POST['TeamName'];
$Message = $_POST['Message'];
$Body = "";
$Body .= "\n";
$Body .= "Email: ";
$Body .= $Email;
$Body .= "\n";
$Body .= "Player1: ";
$Body .= $Name1;
$Body .= "\n";
$Body .= "Player2: ";
$Body .= $Name2;
$Body .= "\n";
$Body .= "Player3: ";
$Body .= $Name3;
$Body .= "\n";
$Body .= "Player4: ";
$Body .= $Name4;
$Body .= "\n";
$Body .= "Player5: ";
$Body .= $Name5;
$Body .= "\n";
$Body .= "TeamName: ";
$Body .= $TeamName;
$Body .= "\n";
$Body .= "Megjegyzes: ";
$Body .= $Message;
$Body .= "\n";
$success = mail($EmailTo, $Subject, $Body, "From: <$EmailFrom>");
}
?>
Related
I have a loop i create form with, but the problem is im not sure how to pass the data from the form to the server.
this is my form:
foreach ($appeals as $appeal) {
$attached_file = $appeal["file_dir"];
$output = '<div class="appeal">';
$output .= '<div class="form-response"><form class="form-signin" method="post">';
$output .= '<div class="form-group">';
$output .= '<input type="text" class="form-control" name="first_name" value="'.$appeal['course_id'].'" required readonly/>';
$output .= '</div>';
$output .= '<div class="form-group">';
$output .= '<label>Student: '.$appeal['first_name']." ".$appeal['last_name'].'</label>';
$output .= '</div>';
$output .= '<div class="form-group">';
$output .= '<label>Submit Date: '.$appeal['submit_date'].'</label>';
$output .= '</div>';
$output .= '<div class="form-group">';
$output .= '<label>Message: '.$appeal['content'].'</label>';
$output .= '</div>';
$output .= '<div class="form-group">';
$output .= '<label for="response">Message:</label>';
$output .= '<textarea class="form-control" name="response" rows="5" required></textarea>';
$output .= '</div>';
$output .= '<button type="submit" name="approve" value="'.$appeal['appeal_id'].'" class="btn btn-default">Approve</button>';
$output .= '<button type="submit" name="decline" value="'.$appeal['appeal_id'].'" class="btn btn-default">Decline</button>';
$output .= '</form></div>';
$output .= '</div>';
echo $output;
}
considering the fact i don't want the data to be visible in the client side, is there a way to add onclick="someFunc(...) to the submit buttons and than pass the variables from $appeal to this function without showing them in the client, or should i consider passing the data using AJAX, but than again how can i call a function with the data from $appeal without revealing it in the client side? thx
so in the last 2 months my website is online, i have been received 2 normal email from my contact form and like 30 empty unfilled form emails. I also use validator http://faireware.de/js/jquery.form-validation-and-hints.js.
The weird is that i don't get these empty for emails when i i.e. dont fill an form and press send. It happens automaticly somehow... a spam bots or something, could it be?
My HTML code is:
<form method="post" action="contactengine.php">
<div class="field required">
<p>Name<br>
<input class="text verifyText hint" name="name" type="text" size="25" title="*Ihr Name..."></p>
</div><!--/field-->
<div class="field required ">
<p>E-Mail<br>
<input class="email verifyMail hint " name="email" type="text" size="25" title="*Ihre E-Mail-Adresse..."></p>
</div><!--/field-->
<div class="field required ">
<p>Nachricht<br>
<textarea name="message" rows="50" cols="50" title="*Schreiben Sie Ihre Nachricht..." class="hint "></textarea></p>
</div><!--/field-->
<p><input class="submit" type="submit" value="Senden"></p>
</form>
and my contactengine.php is:
<?php
$Subject = "Kontaktformular - FaireWare";
$Name = Trim(stripslashes($_POST['name']));
$Email = Trim(stripslashes($_POST['email']));
$Message = Trim(stripslashes($_POST['message']));
$EmailFrom = $Email;
$EmailTo = "info#faireware.de";
// 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\n";
$Body .= "E-Mail: ";
$Body .= $Email;
$Body .= "\n\n";
$Body .= "Nachricht: ";
$Body .= "\n";
$Body .= $Message;
$Body .= "\n\n";
// send email
$success = mail($EmailTo, $Subject, $Body, "From: $Email");
// redirect to success page
if ($success){
print "<meta http-equiv=\"refresh\" content=\"0;URL=contactthanks.html\">";
}
else{
print "<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">";
}
?>
And the empty email forms do come like this:
Name:
E-Mail:
Nachricht:
Does it do it automaticly and how can it surpass validation...? I don't know PHP and very little java, so does anyone have any idea where the problem could be?
Thank you!
You can try this, i have modified your code with basic server side validations.
<?
if(count($_POST) > 0)
{
$Subject = "Kontaktformular - FaireWare";
$Name = trim(stripslashes($_POST['name']));
$Email = trim(stripslashes($_POST['email']));
$Message = trim(stripslashes($_POST['message']));
$EmailTo = "info#faireware.de";
$validationOK = true;
if(empty($Name) || empty($Email) || empty($Message)){
$validationOK = false;
}
if (!$validationOK) {
print "<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">";
exit;
}
else
{
// prepare email body text
$Body = "";
$Body .= "Name: ";
$Body .= $Name;
$Body .= "\n\n";
$Body .= "E-Mail: ";
$Body .= $Email;
$Body .= "\n\n";
$Body .= "Nachricht: ";
$Body .= "\n";
$Body .= $Message;
$Body .= "\n\n";
$headers = 'From: $Email' . "\r\n";
// send email
$success = mail($EmailTo, $Subject, $Body, $headers);
// redirect to success page
if ($success){
print "<meta http-equiv=\"refresh\" content=\"0;URL=contactthanks.html\">";
}
else{
print "<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">";
}
}
}
?>
What i have changed?
Add starting check if $_POST array not 0 and than add basic validation with empty(). If any one field empty email will not send else you will get the email.
Try to update your server-side code to unbreakable to avoid spam. Here is some suggestions.
Google Recaptcha
Honeypot Technique
Also do server side isset check.
if(isset($_POST['name'])){
// Save the data or do the further processing
}
Suggestion: Do not depend on client side validations when developing secure applications.
I have seen lots of questions about this on here and have taken the code I have now from several answers.
But for some reason I cant get it to work and I cant figure out why.
I have a HTML form with the code here:
<form id="quick_contact" name="quick_contact" action="" method="POST">
<div class="input-control text">
<input id="name" name="name" type="text" value="" placeholder="Enter name here">
</div>
<div class="space10"> </div>
<div class="input-control email">
<input id="email" name="email" type="email" value="" placeholder="Enter email address here"/>
</div>
<div class="space10"> </div>
<div class="input-control textarea">
<textarea id="comments" name="comments" placeholder="Enter Comments Here"></textarea>
</div>
<div class="space10"> </div>
<button id="quick_submit" name="quick_submit" onclick="quickContact()">Send</button>
</form>
And I have my jquery here UPDATED as of Thomas' answer:
<script type="text/javascript">
function quickContact(){
$.ajax({
type: "POST",
url: "quick-contact.php",
data:
{
name: $('#name').val().trim(),
email: $('#email').val().trim(),
comments: $('#comments').val().trim(),
},
success: function(html) {
var submitted = $.trim(html);
if (submitted) {
alert("Thanks for your submission");
$('#quick_contact')[0].reset();
return;
} else {
alert("Failed to submit.");
return false;
}
}
});
};
</script>
And here is the PHP which handles the email side of things in a file called "quick-contact.php again updated as of Thomas' answer:
if(isset($_POST) == true){
$status = 1 // init to one, assume there will not be an error
//Store the entered values in the variables
$name = mysql_escape_string(trim($_POST['name']));
$email = mysql_escape_string(trim($_POST['email']));
$comments = mysql_escape_string(trim($_POST['comments']));
$comments = str_replace('\r\n','<br>',$comments);
// EMAIL HEADERS
$headers = "MIME-Version: 1.0\n";
$headers .= "Content-type: text/html; charset=utf-8\n";
$headers .= "X-Priority: 3\n";
$headers .= "X-MSMail-Priority: Normal\n";
$headers .= "X-Mailer: php\n";
$headers .= "From: *****<*****#l*****>\n";
//SEND EMAIL TO BRANCH
// EMAIL TITLE
$subject = $name . " " . get_content(3344);
//message
$message1 = "<style type=\"text/css\">";
$message1 .= "div { font-family: Arial, Verdana, Tahoma; font-size: 10pt; line-height: 120%; }";
$message1 .= "h1 { margin: 0; font-size: 14pt; }";
$message1 .= "h2 { margin: 0; font-size: 12pt; }";
$message1 .= "span { font-size: 9pt; font-weight: bold; }";
$message1 .= "</style>\n";
$message1 .= "<div>";
$message1 .= "<p>" . $name . " " . get_content(3344) . "</p>\n";
$message1 .= "<p>" . get_content(3345) . "</p>\n";
$message1 .= "<p><b>" . ucwords(get_content(2869)) . ":</b> " . $name . "<br />";
$message1 .= "<b>" . ucwords(get_content(27)) . ":</b> " . $email . "<br />";
$message1 .= "<b>" . ucwords(get_content(1258)) . ":</b> " . $comments . "<br />";
$message1 .= "</p>\n";
$message1 .= get_content(893); // King Regards,
$message1 .= "<br /><br />";
$message1 .= "<img src=\"***********\" alt=\"*******\">";
$message1 .= "<br />";
$message1 .= "</div>";
//SEND CUSTOMER AN EMAIL
// EMAIL TITLE
$subject2 = get_content(392);
//message
$message2 = "<style type=\"text/css\">";
$message2 .= "div { font-family: Arial, Verdana, Tahoma; font-size: 10pt; line-height: 120%; }";
$message2 .= "h1 { margin: 0; font-size: 14pt; }";
$message2 .= "h2 { margin: 0; font-size: 12pt; }";
$message2 .= "span { font-size: 9pt; font-weight: bold; }";
$message2 .= "</style>\n";
$message2 .= "<div>";
$message2 .= "<p>" . $name . ",</p>\n";
$message2 .= "<p>" . get_content(392) . "</p>\n";
$message2 .= "<p>" . str_replace("{TEL_NUMBER}", $header_branch_details[0]['Tel'], str_replace("{BRANCH_EMAIL}", $header_branch_details[0]['SalesEmail'], get_content(2764))) . "</p>\n";
$message2 .= get_content(893); // King Regards,
$message2 .= "<br /><br />";
$message2 .= "<img src=\"*********\" alt=\"*********\">";
$message2 .= "<br />";
$message2 .= "</div>";
//Send branch email
$success = mail('***#****.com', $subject, $message1, $headers);
//Send customer email
$success2 = mail($email, $subject2, $message2, $headers);
if (!$success) {
$status = 0;
}
echo $status;
}
Sorry about the mass of code I really hope someone can help me here
Change the submit type to a button type with an onClick event that calls doSomething().
Then, have doSomething() run the ajax call, like so:
function doSomething() {
$.ajax({
type: 'post',
url: 'quick-contact.php',
data:
{
name: $('#name').val().trim(),
email: $('#email').val().trim(),
comments: $('#comments').val().trim(),
},
success: function(html) {
var status = $.trim(html);
if (status) {
alert("Thanks for your submission");
$('#quick_contact')[0].reset();
return;
} else {
alert("Failed to submit.");
return false;
}
}
});
}
Then in your PHP, all you have to do is check if $_POST isset.
if (($_POST)) {
$status = 1; // init to one, assume there will not be an error
$name = $_POST['name'];
//etc, but FILTER the data coming from the client
}
Also, you may want to do something like this near your mail() function:
$success = mail(//etc);
if (!$success) {
$status = 0;
}
echo $status;
If you still have questions, let me know. I'm happy to help.
I want to track my prospects from which URL(like fb, g+ or mailer) they have visited my website.This is all is for understanding visitor for better digital marketing.
My Fiddle: http://jsfiddle.net/dSp4g/
Please help me with code as below
Thanks in advance
HTML
<div class="form-group">
<label for="exampleInputEmail">Full name</label>
<input type="text" class="form-control " id="exampleInputName" placeholder="Enter your full name" style="color:#000 !important;">
</div>
<div class="form-group">
<input type="hidden" class="form-control " id="sourcecode">
</div>
<div class="form-group last">
<button class="mailbtn">Submit</button>
</div>
JS
$('.mailbtn').live('click',function(){
name = $('#exampleInputName').val();
sc = $('#sourcecode').val();
$(document).ready(function() {
if (sourcecode = $.parsequery().s)
{
$("#source").val(sourcecode); }
});
$.ajax({
type: "POST",
async : false,
url: "mail.php",
data: { name:name, sourcecode:sc}
})
.done(function( msg ) {
$('.mail_middle').html('');
$('.mail_middle').html('We will call you to confirm your delivery address.Thank you.');
return false;
});
});
mail.php
<?php
$to = array("my_email1","my_email2");
$message .= "<table border='1'>";
$message .= "<tr><td>Name </td><td>".$_POST['name']."</td></tr>";
$message .= "<tr><td>Source </td><td>".$_POST['sc']."</td></tr>";
$message .= "</table>";
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=utf-8\r\n";
$headers .= 'from: '.$from .'' . "\r\n" .
'Reply-To: '.$from.'' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
foreach($to as $row)
{
mail($row,$subject,$message,$headers);
}
echo "Mail Sent.";
die;
?>
Change $_POST['sc']
$message .= "<tr><td>Source </td><td>".$_POST['sc']."</td></tr>";
to $_POST['sourcecode']
$message .= "<tr><td>Source </td><td>".$_POST['sourcecode']."</td></tr>";
as sourcecode is the name (wheresc is the value)
data: { name:name, sourcecode:sc}
HTML
add a
<input type="hidden" name="the_ref" value="<?= $_SERVER['HTTP_REFERER']; ?>">
JS
modify to
data: { name:name, sourcecode:sc, the_ref:ref}
PHP
add a
$message .= "<tr><td>Visitor came from </td><td>".$_POST['the_ref']."</td></tr>";
your jquery implementation fails because in your php you are trying to read the $_POST['sc'] instead of $_POST['sourcecode']
I have tried a few different ways and am stuck with this. I have a form in a modal that slides out to order some parts. After you submit form it goes through a javascript test then post to a php page to send an email to company to order parts. I have it working except for two things. The radio buttons (three) are showing up unidentified and the "city" text is coming over empty. Here is the code and a link to page is http://arhcycles.com/new/drag-specialties.php
form
//declare our variables
$name = $_POST['name'];
$email = $_POST['email'];
$phone = $_POST['phone'];
$address = $_POST['address'];
$city = $_POST['city'];
$state = $_POST['state'];
$zipcode = $_POST['zipcode'];
$supplier1 = $_POST['supplier1'];
$supplier2 = $_POST['supplier2'];
$supplier3 = $_POST['supplier3'];
$supplier4 = $_POST['supplier4'];
$qty1 = $_POST['qty1'];
$qty2 = $_POST['qty2'];
$qty3 = $_POST['qty3'];
$qty4 = $_POST['qty4'];
$p_number1 = $_POST['p_number1'];
$p_number2 = $_POST['p_number2'];
$p_number3 = $_POST['p_number3'];
$p_number4 = $_POST['p_number4'];
$message = nl2br($_POST['message']);
//get todays date
$todayis = date("l, F j, Y, g:i a") ;
//set a title for the message
$subject = "Parts Order From ARH Cycles";
$body_message = '<html><body style="color:#FFFFFF; background-color: #850000">';
$body_message .= '<table border="1" bordercolor="#ffffff" cellpadding="10">';
$body_message .= '<tr style="background: #850000;"><td><strong>From:</strong> </td><td>'.$name.'</td></tr>';
$body_message .= '<tr style="background: #850000;"><td><strong>Email:</strong> </td><td>'.$email.'</td></tr>';
$body_message .= '<tr style="background: #850000;"><td><strong>Phone:</strong> </td><td>'.$phone.'</td></tr>';
$body_message .= '<tr style="background: #850000;"><td><strong>Address:</strong> </td><td>'.$address .'</td></tr>';
$body_message .= '<tr style="background: #850000;"><td><strong>City:</strong> </td><td>'.$city.'</td></tr>';
$body_message .= '<tr style="background: #850000;"><td><strong>State:</strong> </td><td>'.$state.'</td></tr>';
$body_message .= '<tr style="background: #850000;"><td><strong>Zipcode:</strong> </td><td>'.$zipcode .'</td></tr>';
$body_message .= '</table>';
$body_message .= '<table border="1" bordercolor="#ffffff" cellpadding="10">';
$body_message .= '<tr style="background: #850000;"><td><strong>Supplier:</strong></td><td>' .$supplier1.'</td><td><strong>Quanity:</strong> </td><td>'.$qty1.'</td><td><strong>Part Number:</strong></td><td>'.$p_number1.'</td></tr>';
$body_message .= '<tr style="background: #850000;"><td><strong>Supplier:</strong></td><td> ' .$supplier2.'</td><td><strong>Quanity:</strong> </td><td>'.$qty2.'</td><td><strong>Part Number:</strong></td><td>'.$p_number2.'</td></tr>';
$body_message .= '<tr style="background: #850000;"><td><strong>Supplier:</strong></td><td>' .$supplier3.'</td><td><strong>Quanity:</strong> </td><td>'.$qty3.'</td><td><strong>Part Number:</strong></td><td>'.$p_number3.'</td></tr>';
$body_message .= '<tr style="background: #850000;"><td><strong>Supplier:</strong></td><td>' .$supplier4 .'</td><td><strong>Quanity:</strong> </td><td>'.$qty4.'</td><td><strong>Part Number:</strong></td><td>'.$p_number4.'</td></tr>';
$body_message .= '</table>';
$body_message .= '<table border="1" bordercolor="#ffffff" cellpadding="10">';
$body_message .= '<tr style="background: #850000;"><td colspan="3"><strong>Message:</td></tr>';
$body_message .= '<tr style="background: #850000;"><td rowspan="3"colspan="3">' .$message .'</td></tr>';
$body_message .= '</table>';
$body_message .= '</body></html>';
$headers = "From: " .$email . "r\n" ;
$headers .= "Reply-To: ".$email . "\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
//put your email address here
mail("email#yourdomain.com, $email", $subject, $body_message, $headers);
?>
<!--Display a thankyou message in the callback -->
<div id="mail_response">
<h3>Thank you for your order <?php echo $name ?>!</h3><br />
<p>We will be calling to verify your order and take payment.</p><br />
<p>Please look over your order above and call (281) 970-1200 if incorrect.</p><br />
<h5>Message sent on: </h5>
<p><?php echo $todayis ?></p>
JavaScript
$(document).ready(function(){
//function for contact form dropdown
function contact() {
if ($("#contactForm").is(":hidden")){
$("#contactForm").slideDown("slow");
$("#backgroundPopup").css({"opacity": "0.7"});
$("#backgroundPopup").fadeIn("slow");
}
else{
$("#contactForm").slideUp("slow");
$("#backgroundPopup").fadeOut("slow");
}
}
//run contact form when any contact link is clicked
$(".contact").click(function(){contact()});
//animation for same page links #
$('a[href*=#]').each(function() {
if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'')
&& location.hostname == this.hostname
&& this.hash.replace(/#/,'') ) {
var $targetId = $(this.hash), $targetAnchor = $('[name=' + this.hash.slice(1) +']');
var $target = $targetId.length ? $targetId : $targetAnchor.length ? $targetAnchor : false;
if ($(this.hash).length) {
$(this).click(function(event) {
var targetOffset = $(this.hash).offset().top;
var target = this.hash;
event.preventDefault();
$('html, body').animate({scrollTop: targetOffset}, 500);
return false;
});
}
}
});
//submission scripts
$('.contactForm').submit( function(){
//statements to validate the form
var filter = /^([a-zA-Z0-9_\.\-])+\#(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
var email = document.getElementById('e-mail');
if (!filter.test(email.value)) {
$('.email-missing').show();
} else {$('.email-missing').hide();}
if (document.cform.name.value == "") {
$('.name-missing').show();
} else {$('.name-missing').hide();}
if (document.cform.message.value == "") {
$('.message-missing').show();
} else {$('.message-missing').hide();}
if ((document.cform.name.value == "") || (!filter.test(email.value)) || (document.cform.phone.value == "")){
return false;
}
if ((document.cform.name.value != "") && (filter.test(email.value)) && (document.cform.phone.value != "")) {
//hide the form
$('.contactForm').hide();
//show the loading bar
$('.loader').append($('.bar'));
$('.bar').css({display:'block'});
//send the ajax request
$.post('includes/mail.php',{name:$('#name').val(),
email:$('#e-mail').val(),
phone:$('#phone').val(),
address:$('#address').val(),
city:$('#city').val(),
state:$('#state').val(),
zipcode:$('#zipcode').val(),
supplier1:$('#supplier1').val(),
qty1:$('#qty1').val(),
p_number1:$('#p_number1').val(),
supplier2:$('#supplier2').val(),
qty2:$('#qty2').val(),
p_number2:$('#p_number2').val(),
supplier3:$('#supplier3').val(),
qty3:$('#qty3').val(),
p_number3:$('#p_number3').val(),
supplier4:$('#supplier4').val(),
qty4:$('#qty4').val(),
p_number4:$('#p_number4').val(),
message:$('#message').val()},
//return the data
function(data){
//hide the graphic
$('.bar').css({display:'none'});
$('.loader').append(data);
});
//waits 2000, then closes the form and fades out
setTimeout('$("#backgroundPopup").fadeOut("slow"); $("#contactForm").slideUp("slow")', 4000);
//stay on the page
return false;
}
});
//only need force for IE6
$("#backgroundPopup").css({
"height": document.documentElement.clientHeight
});
});
php
<?php
//declare our variables
$name = $_POST['name'];
$email = $_POST['email'];
$phone = $_POST['phone'];
$address = $_POST['address'];
$city = $_POST['city'];
$state = $_POST['state'];
$zipcode = $_POST['zipcode'];
$supplier1 = $_POST['supplier1'];
$supplier2 = $_POST['supplier2'];
$supplier3 = $_POST['supplier3'];
$supplier4 = $_POST['supplier4'];
$qty1 = $_POST['qty1'];
$qty2 = $_POST['qty2'];
$qty3 = $_POST['qty3'];
$qty4 = $_POST['qty4'];
$p_number1 = $_POST['p_number1'];
$p_number2 = $_POST['p_number2'];
$p_number3 = $_POST['p_number3'];
$p_number4 = $_POST['p_number4'];
$message = nl2br($_POST['message']);
//get todays date
$todayis = date("l, F j, Y, g:i a") ;
//set a title for the message
$subject = "Parts Order From ARH Cycles";
$body_message = '<html><body style="color:#FFFFFF; background-color: #850000">';
$body_message .= '<table border="1" bordercolor="#ffffff" cellpadding="10">';
$body_message .= '<tr style="background: #850000;"><td><strong>From:</strong> </td><td>'.$name.'</td></tr>';
$body_message .= '<tr style="background: #850000;"><td><strong>Email:</strong> </td><td>'.$email.'</td></tr>';
$body_message .= '<tr style="background: #850000;"><td><strong>Phone:</strong> </td><td>'.$phone.'</td></tr>';
$body_message .= '<tr style="background: #850000;"><td><strong>Address:</strong> </td><td>'.$address .'</td></tr>';
$body_message .= '<tr style="background: #850000;"><td><strong>City:</strong> </td><td>'.$city.'</td></tr>';
$body_message .= '<tr style="background: #850000;"><td><strong>State:</strong> </td><td>'.$state.'</td></tr>';
$body_message .= '<tr style="background: #850000;"><td><strong>Zipcode:</strong> </td><td>'.$zipcode .'</td></tr>';
$body_message .= '</table>';
$body_message .= '<table border="1" bordercolor="#ffffff" cellpadding="10">';
$body_message .= '<tr style="background: #850000;"><td><strong>Supplier:</strong></td><td>' .$supplier1.'</td><td><strong>Quanity:</strong> </td><td>'.$qty1.'</td><td><strong>Part Number:</strong></td><td>'.$p_number1.'</td></tr>';
$body_message .= '<tr style="background: #850000;"><td><strong>Supplier:</strong></td><td> ' .$supplier2.'</td><td><strong>Quanity:</strong> </td><td>'.$qty2.'</td><td><strong>Part Number:</strong></td><td>'.$p_number2.'</td></tr>';
$body_message .= '<tr style="background: #850000;"><td><strong>Supplier:</strong></td><td>' .$supplier3.'</td><td><strong>Quanity:</strong> </td><td>'.$qty3.'</td><td><strong>Part Number:</strong></td><td>'.$p_number3.'</td></tr>';
$body_message .= '<tr style="background: #850000;"><td><strong>Supplier:</strong></td><td>' .$supplier4 .'</td><td><strong>Quanity:</strong> </td><td>'.$qty4.'</td><td><strong>Part Number:</strong></td><td>'.$p_number4.'</td></tr>';
$body_message .= '</table>';
$body_message .= '<table border="1" bordercolor="#ffffff" cellpadding="10">';
$body_message .= '<tr style="background: #850000;"><td colspan="3"><strong>Message:</td></tr>';
$body_message .= '<tr style="background: #850000;"><td rowspan="3"colspan="3">' .$message .'</td></tr>';
$body_message .= '</table>';
$body_message .= '</body></html>';
$headers = "From: " .$email . "r\n" ;
$headers .= "Reply-To: ".$email . "\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
//put your email address here
mail("email#yourdomain.com, $email", $subject, $body_message, $headers);
?>
<!--Display a thankyou message in the callback -->
<div id="mail_response">
<h3>Thank you for your order <?php echo $name ?>!</h3><br />
<p>We will be calling to verify your order and take payment.</p><br />
<p>Please look over your order above and call (281) 970-1200 if incorrect.</p><br />
<h5>Message sent on: </h5>
<p><?php echo $todayis ?></p>
</div>