hey, ive edit a contact form i found on net, changed everything i needed, when i click the "submit" button it shows that the form was send succsesfuly but nothing comes up in the email.. what is wrong ?
form code html:
<form method="post" action="../booking/booking.php" id="contactform">
<div class="form">
<div class="six columns noleftmargin">
<label>* Company name:</label>
<input type="text" name="companyname" class="smoothborder" placeholder="* Company name"/>
</div>
<div class="six columns noleftmargin">
<label>* Contact name:</label>
<input type="text" name="contactname" class="smoothborder" placeholder="* Contact name"/>
</div>
<p>
<div class="six columns noleftmargin">
<label>* Event country:</label>
<input type="text" name="country" class="smoothborder" placeholder="* Event country"/>
</div>
<div class="six columns noleftmargin">
<label>* Event city:</label>
<input type="text" name="city" class="smoothborder" placeholder="* Event city"/>
</div>
<p>
<div class="six columns noleftmargin">
<label>* Phone number:</label>
<input type="text" name="phone" class="smoothborder" placeholder="* Phone number"/>
</div>
<div class="six columns noleftmargin">
<label>* Email adress:</label>
<input type="text" name="email" class="smoothborder" placeholder="* Email adress"/>
<label for="select"></label>
</div>
<div class="six columns noleftmargin">
<label>* Skype:</label>
<input type="text" name="skype" class="smoothborder" placeholder="* Skype"/>
<label for="select"></label>
</div>
<div class="six columns noleftmargin">
<label>* Aritst:</label>
<input type="text" name="artist" class="smoothborder" placeholder="* Artist"/>
<br>
<label for="select"></label>
</div>
<p>
<input type="submit" id="submit" class="readmore" value="Submit">
</p>
PHP code:
<?php
if(isset($_POST['email'])) {
// EDIT THE 2 LINES BELOW AS REQUIRED
$email_to = "
[email protected]";
$email_subject = "Booking Request";
function died($error) {
// your error code can go here
echo "We are very sorry, but there were error(s) found with the form you submitted. ";
echo "These errors appear below.<br /><br />";
echo $error."<br /><br />";
echo "Please go back and fix these errors.<br /><br />";
die();
}
// validation expected data exists
if(!isset($_POST['companyname']) ||
!isset($_POST['contactname']) ||
!isset($_POST['country']) ||
!isset($_POST['city']) ||
!isset($_POST['phone']) ||
!isset($_POST['email']) ||
!isset($_POST['skype']) ||
!isset($_POST['artist'])) {
died('We are sorry, but there appears to be a problem with the form you submitted.');
}
$companyname = $_POST['companyname']; // required
$contactname = $_POST['contactname']; // required
$country = $_POST['country']; // required
$city = $_POST['city']; // required
$phone = $_POST['phone']; // required
$email = $_POST['email']; // required
$skype = $_POST['skype']; // not required
$artist = $_POST['artist']; // required
$error_message = "";
$email_exp = '/^[A-Za-z0-9._%-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$/';
if(!preg_match($email_exp,$email)) {
$error_message .= 'The Email Address you entered does not appear to be valid.<br />';
}
$string_exp = "/^[A-Za-z .'-]+$/";
if(!preg_match($string_exp,$companyname)) {
$error_message .= 'The First Name you entered does not appear to be valid.<br />';
}
if(!preg_match($string_exp,$contactname)) {
$error_message .= 'The Last Name you entered does not appear to be valid.<br />';
}
if(!preg_match($string_exp,$country)) {
$error_message .= 'The Last Name you entered does not appear to be valid.<br />';
}
if(!preg_match($string_exp,$city)) {
$error_message .= 'The Last Name you entered does not appear to be valid.<br />';
}
if(!preg_match($string_exp,$phone)) {
$error_message .= 'The Last Name you entered does not appear to be valid.<br />';
}
if(!preg_match($string_exp,$skype)) {
$error_message .= 'The Last Name you entered does not appear to be valid.<br />';
}
if(!preg_match($string_exp,$artist)) {
$error_message .= 'The Last Name you entered does not appear to be valid.<br />';
}
if(strlen($error_message) > 0) {
died($error_message);
}
$email_message = "Form details below.\n\n";
function clean_string($string) {
$bad = array("content-type","bcc:","to:","cc:","href");
return str_replace($bad,"",$string);
}
$email_message .= "Company Name: ".clean_string($companyname)."\n";
$email_message .= "Contact Name: ".clean_string($contactname)."\n";
$email_message .= "Country: ".clean_string($country)."\n";
$email_message .= "City: ".clean_string($city)."\n";
$email_message .= "Phone Number: ".clean_string($phone)."\n";
$email_message .= "Email: ".clean_string($email)."\n";
$email_message .= "Skype: ".clean_string($skype)."\n";
$email_message .= "Artist: ".clean_string($artist)."\n";
// create email headers
$headers = 'From: '.$email_from."\r\n".
'Reply-To: '.$email_from."\r\n" .
'X-Mailer: PHP/' . phpversion();
@mail($email_to, $email_subject, $email_message, $headers);
?>
<!-- include your own success html here -->
Thank you for contacting us. We will be in touch with you very soon.
<?php
}
?>