This has been bugging me all day and I've given up trying to figure it out for myself, but the answer's probably really obvious...
My contact form works fine, however I don't receive input for all fields. I only get name, phone, email and message. I've given the form fields a name attribute so I'm not sure what's happening.
Here is the HTML:
<form name="sentMessage" id="contactForm" novalidate>
<div class="row">
<div class="col-md-6">
<div class="form-group">
<input type="name" class="form-control" placeholder="Your Name *" name="name" id="name" required data-validation-required-message="Please enter your name.">
<p class="help-block text-danger"></p>
</div>
<div class="form-group">
<input type="phone" class="form-control" placeholder="Your Phone Number *" name="phone" id="phone" required data-validation-required-message="Please enter your phone number.">
<p class="help-block text-danger"></p>
</div>
<div class="form-group">
<input type="email" class="form-control" placeholder="Your Email *" name="email" id="email" required data-validation-required-message="Please enter your email address.">
<p class="help-block text-danger"></p>
</div>
<div class="form-group">
<input type="text" class="form-control" name="suburb" placeholder="Your Suburb *" id="suburb" required data-validation-required-message="Please enter your address.">
<p class="help-block text-danger"></p>
</div>
<div class="select">
<div class="col-sm-6">
<div class="form-group">
<select class="selectpicker" name="state" id="state" data-width="100%" data-height="100%" title="Choose State *" data-style="btn-primary">
<option>QLD</option>
<option>NSW</option>
</select>
</div>
</div>
</div>
<div class="right-form-column">
<div class="col-sm-6">
<div class="form-group">
<input type="number" class="form-control" placeholder="Post Code *" name="postcode" id="postcode" required data-validation-required-message="Please enter your post code.">
<p class="help-block text-danger"></p>
</div>
</div>
</div>
</div>
<div class="col-md-6">
<div class="select">
<div class="col-xs-6">
<div class="form-group">
<select class="selectpicker" name="product1" id="product1" data-width="100%" data-height="100%" data-live-search="true" title="Choose Product" data-style="btn-primary">
<optgroup label="100 Series">
<option>90mm Grey Standard</option>
</optgroup>
</select>
</div>
</div>
</div>
<div class="right-form-column">
<div class="col-xs-6">
<div class="form-group">
<input type="number" class="form-control" placeholder="Quantity" name="quantity1" id="quantity1">
<p class="help-block text-danger"></p>
</div>
</div>
</div>
<div class="select">
<div class="col-xs-6">
<div class="form-group">
<select class="selectpicker" name="product2" id="product2" data-width="100%" data-height="100%" data-live-search="true" title="Choose Product" data-style="btn-primary">
<optgroup label="100 Series">
<option>90mm Grey Standard</option>
</optgroup>
</select>
</div>
</div>
</div>
<div class="right-form-column">
<div class="col-xs-6">
<div class="form-group">
<input type="number" class="form-control" placeholder="Quantity" name="quantity2" id="quantity2">
<p class="help-block text-danger"></p>
</div>
</div>
</div>
<div class="select">
<div class="col-xs-6">
<div class="form-group">
<select class="selectpicker" name="product3" id="product3" data-width="100%" data-height="100%" data-live-search="true" title="Choose Product" data-style="btn-primary">
<optgroup label="100 Series">
<option>90mm Grey Standard</option>
</optgroup>
</select>
</div>
</div>
</div>
<div class="right-form-column">
<div class="col-xs-6">
<div class="form-group">
<input type="number" class="form-control" placeholder="Quantity" name="quantity3" id="quantity3">
<p class="help-block text-danger"></p>
</div>
</div>
</div>
<div class="form-group">
<textarea class="form-control" placeholder="Additional comments" name="message" id="message"></textarea>
<p class="help-block text-danger"></p>
</div>
</div>
<div class="clearfix"></div>
<div class="col-lg-12 text-center">
<div id="success"></div>
<button type="submit" class="btn btn-xl" name="submit">submit</button>
</div>
</div>
</form>
And the PHP:
<?php
// check if fields passed are empty
if(empty($_POST['name']) ||
empty($_POST['phone']) ||
empty($_POST['email']) ||
empty($_POST['message']) ||
!filter_var($_POST['email'],FILTER_VALIDATE_EMAIL))
{
echo "No arguments Provided!";
return false;
}
$name = $_POST['name'];
$phone = $_POST['phone'];
$email_address = $_POST['email'];
$message = $_POST['message'];
// create email body and send it
$to = 'myname#mydomain.com'; // PUT YOUR EMAIL ADDRESS HERE
$email_subject = "P Services Contact Form: $name"; // EDIT THE EMAIL SUBJECT LINE HERE
$email_body = "You have received a new message from your website's contact form.\n\n"."Here are the details: From: $name\n Phone: $phone\n E-Mail: $email_address\n Suburb: $suburb\n State: $state\n Post Code: $postcode\n Product: $product1\n Quantity: $quantity1\n Product: $product2\n Quantity: $quantity2\n Product: $product3\n Quantity: $quantity3\n Message:\n $message";
$headers = "From: noreply#yourdomain.com\n";
$headers .= "Reply-To: $email_address";
if(mail($to,$email_subject,$email_body,$headers)){
echo "Mail sent successfully.";
}
else{ echo "Error.";
}
?>
make sure that, you've removed disabled tag in html elemets.
THIS IS WRONG. PHP WON'T RECOGONIZE YOUR ELEMENT.
<input type="text" disabled>
INSTED OF USING disabled you can use readonly.
THIS IS THE CORRECT METHORD
<input type="text" readonly>
Your code returns all the information for me
All i did was change the form method so all the data is being passed its just needs to be handled correctly in your PHP
The only thing you need to change is specify the method of form submission (POST or GET).
Either use
<form name="sentMessage" id="contactForm" novalidate method="POST">
OR
Access the form variables using $_GET like $_GET['name'])
Related
This question already has answers here:
PHP parse/syntax errors; and how to solve them
(20 answers)
Closed 6 years ago.
I'm building a site, and am having problems with the php form. I have looked through and cannot find anything that I see as wrong. However, I am also not very proficient with PHP and have never created a form like this before. Thank you very much if you can help.
Here is the code:
PHP:
<?php
$company = $_POST['company'];
$email = $_POST['email'];
$name = $_POST['name'];
$phone = $_POST['phone'];
$numberofvehicles = $_POST['numofvehicles'];
$date= $_POST['date'];
$time = $_POST['time'];
$address = $_POST['address'];
$to = 'email#email.com';
$subject = "GPS Form Request: $company\n";
$body = "From: $name\n E-Mail: $email\n Company:\n $company Phone: $phone\n Date: $date\n Time: $time\n Address: $address\n Number of Vehicles: $numberofvehicles\n";
$headers = "From: $email" . "\r\n" .
"Reply-To: $email" . "\r\n" .
"X-Mailer: PHP/" . phpversion();
if(isset($_POST['submit']){
mail ($to, $subject, $body, $headers); //mail sends it to the SMTP server side which sends the email
echo "<p>Your message has been sent!</p>";
}
else {
echo "<p>Something went wrong, go back and try again!</p>";
}
?>
HTML:
<form id="contact-form" method="post" action="/php/email.php" role="form">
<fieldset>
<div class="messages"></div>
<div class="controls">
<div class="row">
<div class="col-md-6">
<div class="form-group">
<label for="company_name">Your Company's Name</label>
<input id="company_name" type="text" name="company" class="form-control" placeholder="Please enter your company's name *" required="required" data-error="Firstname is required.">
<div class="help-block with-errors"></div>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label for="your_name">Your Name</label>
<input id="your_name" type="text" name="name" class="form-control" placeholder="Please enter your first and last name *" required="required" data-error="Lastname is required.">
<div class="help-block with-errors"></div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-6">
<div class="form-group">
<label for="form_email">Preferred Email</label>
<input id="form_email" type="email" name="email" class="form-control" placeholder="Please enter your preferred email *" required="required" data-error="Valid email is required.">
<div class="help-block with-errors"></div>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label for="form_phone">Preferred Phone</label>
<input id="form_phone" type="tel" name="phone" class="form-control" placeholder="Please enter your preferred phone number">
<div class="help-block with-errors"></div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-6">
<div class="form-group">
<label for="vehicles_number">Number of Vehicles</label>
<input id="vehicles_number" type="text" name="numofvehicles" class="form-control" placeholder="How many vehicles for installation?">
<div class="help-block with-errors"></div>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label for="install_address">Installation Address</label>
<input id="input_address" type="text" name="address" class="form-control" placeholder="What is the installation address?">
<div class="help-block with-errors"></div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-6">
<div class="form-group">
<label for="install_date">Choose a Date for Installation</label>
<input id="calendar" name="date" type="text" class="form-control" placeholder="Please choose a date for installation" >
<div class="help-block with-errors"></div>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label for="install_time">Choose a Time for Installation</label>
<input id="install_time" type="time" name="phone" class="form-control" placeholder="Please choose a time for installation">
<div class="help-block with-errors"></div>
</div>
</div>
</div>
<div class="row">
</fieldset>
<fieldset>
<div class="col-md-12">
<input type="submit" id="submit" name="submit" class="btn btn-success btn-send" value="Send message">
</div>
</div>
</div>
</div>
</fieldset>
</form>
</container>
</div>
</div>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script src="js/bootstrap-datepicker.js"></script>
<script>
$('#calendar').datepicker({
inline: true,
firstDay: 1,
showOtherMonths: true,
dayNamesMin: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat']
});
</script>
</body>
</div>
You are missing a closing parenthesis bracket in your php if statement.
if(isset($_POST['submit']))
At the very end of that statement ^
I have this html code for the form:
<form action="index.php" method="post" id="form" class="form" role="form">
<h4 class="form-heading">Luxury at an affordable price</h4>
<div class="form-validation alert"></div>
<div class="form-group">
<label for="form-name">Name</label>
<input type="text" name="name" id="form-name" class="form-control" placeholder="Your Full Name" autocomplete="off">
</div>
<div class="form-group">
<label for="form-email">Email Address</label>
<input type="email" name="email" id="form-email" class="form-control" placeholder="Your Valid Email Address" autocomplete="off">
</div>
<div class="form-group">
<label for="form-phone">Phone Number</label>
<input type="phone" name="phone" id="form-phone" class="form-control" placeholder="Your Valid Phone Number" autocomplete="off">
</div>
<div class="form-group">
<label for="form-info">Package</label>
<p>
<select type="info" name="info" id="form-info" class="form-control">
<option value="Diamond">Diamond</option>
<option value="Gold">Gold</option>
<option value="silver">Silver</option>
<option value="silver">Custom</option>
</select>
</p>
</div>
<div class="form-group">
<label for="form-pax"># of People</label>
<input type="pax" name="pax" id="form-pax" class="form-control" placeholder="Number of People in your Party" autocomplete="off">
</div>
<div class="form-group">
<label for="form-com">Comments</label>
<input type="com" name="com" id="form-com" class="form-control" placeholder="Additional Comments" autocomplete="off">
</div>
<div class="form-group form-group-submit">
<button class="btn btn-primary btn-lg btn-block" data-loading-text="Action Button">More Info</button>
</div>
</form>
And also i have this Php code:
<?php
if(empty($_POST['name']) ||
empty($_POST['email']) ||
empty($_POST['phone']) ||
empty($_POST['info']) ||
empty($_POST['pax']) ||
!filter_var($_POST['email'],FILTER_VALIDATE_EMAIL))
{
echo '<script type="text/javascript">alert("Your data is not valid!");</script>';
return false;
}
$name = $_POST['name'];
$email = $_POST['email'];
$phone = $_POST['phone'];
$info = $_POST['info'];
$pax= $_POST['pax'];
$com= $_POST['com'];
// Create the email and send the message
$to = 'rubengallardo.88#gmail.com'; // Add your email address inbetween the '' replacing yourname#yourdomain.com - This is where the form will send a message to.
$email_subject = "Contacto de cancunprivateparty.com : $name";
$email_body = "Nuevo mensaje del formulario de CancĂșn Private Party.\n\n"."Estos son los detalles:\n\nNombre: $name\n\nEmail: $email\n\nTel: $phone\n\nPaquete: $info \n\n # de Pax: $pax \n\n Comentarios: $com" ;
$headers = "From: noreply#cancunprivateparty.com\n"; // This is the email address the generated message will be from. We recommend using something like noreply#yourdomain.com.\n\n Comentarios: $com
$headers .= "Reply-To: $email_address";
mail($to,$email_subject,$email_body,$headers);
echo '<script type="text/javascript">alert("Your message has been sent!");</script>';
echo '<meta http-equiv="refresh" content="0; URL=http://www.cancunprivateparty.com">';
return true;
?>
When i fill the form and send the email i get a error that says "your data is not valid" even if my data is valid.
What could be the problem here?
is your <form> tag missing?
Works fine for me when set:
contact.html
<form method="post" action="contact_form.php">
<h4 class="form-heading">Luxury at an affordable price</h4>
<div class="form-validation alert"></div>
<div class="form-group">
<label for="form-name">Name</label>
<input type="text" name="name" id="form-name" class="form-control" placeholder="Your Full Name" autocomplete="off">
</div>
<div class="form-group">
<label for="form-email">Email Address</label>
<input type="email" name="email" id="form-email" class="form-control" placeholder="Your Valid Email Address" autocomplete="off">
</div>
<div class="form-group">
<label for="form-phone">Phone Number</label>
<input type="phone" name="phone" id="form-phone" class="form-control" placeholder="Your Valid Phone Number" autocomplete="off">
</div>
<div class="form-group">
<label for="form-info">Package</label>
<p>
<select type="info" name="info" id="form-info" class="form-control">
<option value="Diamond">Diamond</option>
<option value="Gold">Gold</option>
<option value="silver">Silver</option>
<option value="silver">Custom</option>
</select>
</p>
</div>
<div class="form-group">
<label for="form-pax"># of People</label>
<input type="pax" name="pax" id="form-pax" class="form-control" placeholder="Number of People in your Party" autocomplete="off">
</div>
<div class="form-group">
<label for="form-com">Comments</label>
<input type="com" name="com" id="form-com" class="form-control" placeholder="Additional Comments" autocomplete="off">
</div>
<div class="form-group form-group-submit">
<button class="btn btn-primary btn-lg btn-block" data-loading-text="Action Button">More Info</button>
</div>
</form>
contact_form.php
<?php
if(empty($_POST['name']) ||
empty($_POST['email']) ||
empty($_POST['phone']) ||
empty($_POST['info']) ||
empty($_POST['pax']) ||
!filter_var($_POST['email'],FILTER_VALIDATE_EMAIL))
{
echo '<script type="text/javascript">alert("Your data is not valid!");</script>';
return false;
}
echo "yes";
return true;
?>
I Have two forms on my site. One works fine and the other sends email with email_from: etc but doesn't capture any of the form data.
Wondering what it may be. I can post the form that is working along with it's html too if that would help debug. Very much a novice and built form using stack overflow/other sites.
Coffee
<div class="form-group">
<label class="col-sm-3 control-label">Quantity</label>
<div class="col-sm-4">
<input type="text" name="quantity" class="form-control" placeholder="Quantity : " required>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">Name</label>
<div class="col-sm-6">
<input type="text" name="name" class="form-control" placeholder="Name : " required>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">Email address</label>
<div class="col-sm-6">
<input type="email" name="email" class="form-control" placeholder="Email address : " required>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">Shipping Address</label>
<div class="col-sm-6">
<textarea class="form-control" name="shipping_address" rows="8" placeholder="Shipping Address : " required></textarea>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">Payment Method</label>
<div class="col-sm-6">
<select class="form-control" required>
<option value="Paypal">Paypal</option>
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">Notes</label>
<div class="col-sm-6">
<textarea class="form-control" name="notes" rows="8" placeholder="Notes : "></textarea>
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-3 col-sm-10">
<button type="submit" class="btn btn-black">Order Now</button></a>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
And here is the php
<?php
if(isset($_POST ['submit']))
{
$coffee = ($_POST['coffee']));
$quantity = ($_POST['quantity']));
$name = ($_POST['name']));
$email = ($_POST['email']));
$shipping_address = ($_POST['shipping_address']));
$notes = ($_POST['notes']));
}
$email_from ='paradigmcoffee#gmail.com';
$email_subject="New Order Submission";
$email_body ="You have received a new message from user $name.\n".
"Email_address:$email\n".
"Coffee: $coffee\n".
"Quantity: $quantity\n".
"Shipping_Address: $shipping_address\n".
"Notes: $notes\n".
$to ="paradigmcoffee#gmail.com";
$headers = "From: $email \r\n";
mail($to,$email_from,$email_subject,$email_body,$headers);
header("Location: http://www.paradigmcoffee.co/order_thanks.html");
?>
From what you have supplied, likely the reason you can not get data is because you are not sending anything called submit. Try naming your button:
<!-- name="submit" added -->
<button name="submit" type="submit" class="btn btn-black">Order Now</button>
You can do this or make a hidden field:
<input type="hidden" name="submit" value="1" />
<section id="contact">
<div class="container">
<div class="row">
<div class="col-lg-12 text-center">
<h2>Contact Me</h2>
<hr class="star-primary">
</div>
</div>
<div class="row">
<div class="col-lg-8 col-lg-offset-2">
<!-- To configure the contact form email address, go to mail/contact_me.php and update the email address in the PHP file on line 19. -->
<!-- The form should work on most web servers, but if the form is not working you may need to configure your web server differently. -->
<form name="sentMessage" id="contactForm" onsubmit="return validate()" action="contactme.php">
<div class="row control-group">
<div class="form-group col-xs-12 floating-label-form-group controls">
<label>Name</label>
<input type="text" class="form-control" placeholder="Name" id="name" required data-validation-required-message="Please enter your name.">
<p class="help-block text-danger"></p>
</div>
</div>
<div class="row control-group">
<div class="form-group col-xs-12 floating-label-form-group controls">
<label>Email Address</label>
<input type="email" class="form-control" placeholder="Email Address" id="emailz" required data-validation-required-message="Please enter your email address.">
<p class="help-block text-danger"></p>
</div>
</div>
<div class="row control-group">
<div class="form-group col-xs-12 floating-label-form-group controls">
<label>Phone Number</label>
<input type="tel" class="form-control" placeholder="Phone Number" id="phone" required data-validation-required-message="Please enter your phone number.">
<p class="help-block text-danger"></p>
</div>
</div>
<div class="row control-group">
<div class="form-group col-xs-12 floating-label-form-group controls">
<label>Message</label>
<textarea rows="5" class="form-control" placeholder="Message" id="message" required data-validation-required-message="Please enter a message."></textarea>
<p class="help-block text-danger"></p>
</div>
</div>
<br>
<div id="success"></div>
<div class="row">
<div class="form-group col-xs-12">
<input type="submit" value="Submit" name="Submit" class="btn btn-success btn-lg"></input>
</div>
</div>
</form>
</div>
</div>
</div>
</section>
<-----PHP----->
<?php
if(empty($_POST['name']) ||
empty($_POST['emailz']) ||
empty($_POST['phone']) ||
empty($_POST['message']) ||
!filter_var($_POST['emailz'],FILTER_VALIDATE_EMAIL))
{
echo "No arguments Provided!!";
return false;
}
$name = $_POST['name'];
$email = $_POST['emailz'];
$phone = $_POST['phone'];
$message = $_POST['message'];
$headers = "From: noreply#yourdomain.com\n"; // This is the email address the generated message will be from
$headers .= "Reply-To: $emailz";
$subject = 'New Message - Kieronb- $name';
$body = "You have received a new message from your website contact form.\n\n"."Here are the details:\n\nName: $name\n\nEmail: $emailz\n\nPhone: $phone\n\nMessage:\n$message";
mail("k#gmail.com",$subject,$body,$headers);
return true;
?>
SO, the above is the HTML and the PHP, now the majority of this code has been frankensteined from a bootstrap project, but i thought i would just have a play with the contact form too, but it is going all the way through to the missing arguments catch at the beginning of the PHP.
I cant see why the data is coming through empty- have i missed something painfully obvious?
I am running on a web server, not locally.
Thanks
Edit; thanks everyone, i forgot my method, and names on the form!
Your form fields do not have the name attribute. Without them their values are not submitted with the form.
<input type="email" class="form-control" placeholder="Email Address" id="emailz" required data-validation-required-message="Please enter your email address.">
should be
<input type="email" name="emailz" class="form-control" placeholder="Email Address" id="emailz" required data-validation-required-message="Please enter your email address.">
And your <form> needs to have the method specified as POST or else it defaults to GET:
<form method="post" name="sentMessage" id="contactForm" onsubmit="return validate()" action="contactme.php">
I have a Bootstrap 3 form that displays the success message: "Your message has been sent" but I don't receive any emails. Not even in my spam/junk folder. It validates properly but no email is sent. Here's the PHP code. Please help!
PHP
<?php
// check if fields passed are empty
if(empty($_POST['firstname']) ||
empty($_POST['lastname']) ||
empty($_POST['address']) ||
empty($_POST['address2']) ||
empty($_POST['city']) ||
empty($_POST['state_province']) ||
empty($_POST['country']) ||
empty($_POST['zip']) ||
empty($_POST['phone']) ||
empty($_POST['email']) ||
empty($_POST['checkbox']) ||
empty($_POST['comment']) ||
{
echo "No arguments Provided!";
return false;
}
$firstname = $_POST['firstname'];
$lastname = $_POST['lastname'];
$address = $_POST['address'];
$address2 = $_POST['address2'];
$city = $_POST['city'];
$state_province = $_POST['state_province'];
$country = $_POST['country'];
$zip = $_POST['zip'];
$phone = $_POST['phone'];
$email_address = $_POST['email'];
$checkbox = $_POST['checkbox'];
$message = $_POST['comment'];
// create email body and send it
$to = 'email#example.com'; // put your email
$email_subject = "Contact form submitted by: $firstname";
$email_body = "You have received a new message. \n\n".
"Here are the details:\n \nFirst Name: $firstname \n Last Name: $lastname\n Address: $address\n Address2: $address2\n City: $city\n State/Province: $state_province\n Country: $country\n zip: $zip\n Phone: $phone\n Email: $email_address\n Checkbox: $checkbox\n Message: \n $message";
$headers = "From: $email_address\n";
$headers = "Reply-To: $email_address";
mail($to,$email_subject,$email_body,$headers);
return true;
?>
HTML
<form class="form-horizontal" role="form" id="ContactUs" novalidate>
<!-- First Name -->
<div class="form-group">
<label class="control-label col-md-4" for="firstname"><abbr title="Required field">*</abbr>First Name</label>
<div class="col-md-8">
<input type="text" class="form-control" id="firstname" name="firstname" placeholder="First Name" required data-validation-required-message="Please enter your first name">
<div class="help-block"></div>
</div>
</div>
<!-- Last Name -->
<div class="form-group">
<label class="control-label col-md-4" for="lastname"><abbr title="Required field">*</abbr>Last Name</label>
<div class="col-md-8">
<input type="text" class="form-control" id="lastname" name="lastname" placeholder="Last Name" required data-validation-required-message="Please enter your last name">
<div class="help-block"></div>
</div>
</div>
<!-- Address -->
<div class="form-group">
<label class="control-label col-md-4" for="address"><abbr title="Required field">*</abbr>Address</label>
<div class="col-md-8">
<input type="text" class="form-control" id="address" name="address" placeholder="Address" required data-validation-required-message="Please enter your address">
<div class="help-block"></div>
</div>
</div>
<!-- Address 2 -->
<div class="form-group">
<label class="control-label col-md-4" for="address2">Address 2</label>
<div class="col-md-8">
<input type="text" class="form-control" id="address2" name="address2" placeholder="Address 2">
</div>
</div>
<!-- City -->
<div class="form-group">
<label class="control-label col-md-4" for="city"><abbr title="Required field">*</abbr>City</label>
<div class="col-md-8">
<input type="text" class="form-control" id="city" name="city" placeholder="City" required data-validation-required-message="Please enter your city">
<div class="help-block"></div>
</div>
</div>
<!-- State/Province -->
<div class="form-group">
<label class="control-label col-md-4" for="state_province"><abbr title="Required field">*</abbr>State/Province</label>
<div class="col-md-8">
<input type="text" class="form-control" id="state_province" name="state_province" placeholder="State/Province" required data-validation-required-message="Please enter your State or Province">
<div class="help-block"></div>
</div>
</div>
<!-- Country -->
<div class="form-group">
<label class="control-label col-md-4" for="country"><abbr title="Required field">*</abbr>Country</label>
<div class="col-md-8">
<input type="text" class="form-control" id="country" name="country" placeholder="Country" required data-validation-required-message="Please enter your Country of residence">
<div class="help-block"></div>
</div>
</div>
<!-- Zip/Postal Code -->
<div class="form-group">
<label class="control-label col-md-4" for="zip"><abbr title="Required field">*</abbr>Zip/Postal Code</label>
<div class="col-md-8">
<input type="text" class="form-control" id="zip" name="zip" placeholder="Zip/Postal Code" required data-validation-required-message="Please enter your Zip or Postal Code">
<div class="help-block"></div>
</div>
</div>
<!-- Phone -->
<div class="form-group">
<label class="control-label col-md-4" for="phone">Phone</label>
<div class="col-md-8">
<input type="tel" class="form-control" id="phone" name="phone" placeholder="Phone">
</div>
</div>
<!-- Email Address -->
<div class="form-group">
<label class="control-label col-md-4" for="email"><abbr title="Required field">*</abbr>Email address</label>
<div class="col-md-8">
<input type="email" class="form-control" id="email" name="email" placeholder="Email Address" required data-validation-required-message="Please enter your email">
<div class="help-block"></div>
</div>
</div>
<!-- Mailing List -->
<div class="form-group">
<label class="control-label col-md-4" for="checkbox">Include in mailing list</label>
<div class="col-md-8">
<input type="checkbox" class="form-control" id="checkbox" name="checkbox" value="1">
</div>
</div>
<!-- Comment -->
<div class="form-group">
<label class="control-label col-md-4" for="comment">Comment</label>
<div class="col-md-8">
<textarea class="form-control" id="comment" name="comment" rows="3"></textarea>
</div>
</div>
<!-- Buttons -->
<div class="form-group">
<div class="col-md-8 col-md-offset-4">
<div id="success"> </div> <!-- For success/fail messages -->
<button type="submit" class="btn btn-primary pull-right">Submit</button>
</div>
</div>
</form>
UPDATE 8:50PM 03/09
I uploaded this to a different host and now, when I submit the form I'm getting an error :"Message cannot be sent!"
you are sending the email to "email#example.com"
Probably try sending it to your email address, by changing the $to variable.
Also change the headers. From This
$headers = "From: $email_address\n";
$headers = "Reply-To: $email_address";
To:
$headers = "From: $email_address\n";
$headers .= "Reply-To: $email_address";
note the .= on the second line, this means add the string onto headers vs replacing the content of the variable.
And maybe change this:
mail($to,$email_subject,$email_body,$headers);
return true;
to
return mail($to,$email_subject,$email_body,$headers); // will return true on success send, or false if it failed to send.