All data is not sent with form id=”contactform” and all data sent without id=”contactform”

Hi i am working with a onepage website
the main issue is with form

if i do this

<form method="post" action="scripts/contact.php" role="form" name="contactform" id="contactform">

the form is submitted but only few data is delivered in email

but if i do this

<form class="form" method="post" action="scripts/contact.php"> 

the form is submitted and all the data is delivered in email but in this the main issue is the successful report page is displayed in a new page .

My Form is ;

<div class="form-group">
    <label for="fullname" class="col-sm-3 col-xs-12">Full name</label>
    <div class="col-sm-9 col-xs-12">
        <input type="text" class="form-control" name="name" id="name" placeholder="Your Name" required>
<div class="form-group">
    <label for="phone" class="col-sm-3 col-xs-12">Phone</label>
    <div class="col-sm-9 col-xs-12">
        <input type="text" class="form-control" name="phone" id="phone" placeholder="Your Phone" required>
<div class="form-group">
    <label for="email" class="col-sm-3 col-xs-12">Email</label>
    <div class="col-sm-9 col-xs-12">
        <input type="email" class="form-control" name="email" id="email" placeholder="your Email" required>

<div class="form-group">
    <label for="pdate" class="col-sm-3 col-xs-12">Pick up date</label>
    <div class="col-sm-9 col-xs-12">
        <input type="text" class="form-control" name="pdate" id="pdate" placeholder="Pick up date" required>

<div class="form-group">
    <label for="paddress" class="col-sm-3 col-xs-12">Pick up</label>
    <div class="col-sm-9 col-xs-12">
        <input type="text" class="form-control" name="paddress" id="paddess" placeholder="Pick up Address" required>

<div class="form-group">
    <label for="daddress" class="col-sm-3 col-xs-12">Destination</label>
    <div class="col-sm-9 col-xs-12">
        <input type="text" class="form-control" name="daddress" id="daddress" placeholder="Destination Address" required>
<button type="submit" class="btn btn-primary btn-lg btn-block">Book Now</button>



if(!$_POST) exit;

 * just replace email address with your email address
$address = ""; 

// Email address verification, do not edit this part.
function isEmail($email) {

if (!defined("PHP_EOL")) define("PHP_EOL", "\r\n");

$name = $_POST['name'];
$email = $_POST['email'];
$phone = $_POST['phone'];
$pdate = $_POST['pdate'];
$paddress = $_POST['paddress'];
$daddress = $_POST['daddress'];
$subject = $_POST['subject'];
$msg = $_POST['msg'];

if(trim($name) == '') {
	echo '<div class="error_message">Please Enter Your Name :) .</div>';
} else if(trim($email) == '') {
	echo '<div class="error_message"> Please enter a valid email address :) .</div>';
} else if(!isEmail($email)) {
	echo '<div class="error_message">You have enter an invalid e-mail address.</div>';

/*if(trim($subject) == '') {
	echo '<div class="error_message">Please enter a subject.</div>';
} else if(trim($msg) == '') {
	echo '<div class="error_message">Please enter your message.</div>';
} */

if(get_magic_quotes_gpc()) {
	$msg = stripslashes($msg);

// Configuration option.
// i.e. The standard subject will appear as, "You've been contacted by  ."
// Example, $e_subject = '$name . ' has contacted you via Your Website.';
$e_subject = 'You\'ve been contacted From website by ' . $name . '.';

// You can change this if you feel that you need to.

$e_body = "You have been contacted by $name with regards to $subject, their additional message is as follows." . PHP_EOL . PHP_EOL;

$e_content = "\"$msg\"" . PHP_EOL . PHP_EOL;

$e_body = "This mail Send by $name" . PHP_EOL . PHP_EOL;
$e_email = "Email: $email" . PHP_EOL . PHP_EOL;
$e_phone = "Phone: $phone" . PHP_EOL . PHP_EOL;
$e_pdate = "Pick up date : $pdate" . PHP_EOL . PHP_EOL;
$e_paddress = "Pick Up address : $paddress" . PHP_EOL . PHP_EOL;
$e_daddress = "Destination Address: $daddress" . PHP_EOL . PHP_EOL;

$e_reply = "You can contact $name via email, $email or via phone $phone";

$msg = wordwrap($e_body .$e_email. $e_phone. $e_pdate. $e_paddress. $e_daddress. $e_reply, 70);

/*$e_content = "\"$msg\"" . PHP_EOL . PHP_EOL;
$e_reply = "You can contact $name via email, $email ";

$msg = wordwrap( $e_body . $e_content . $e_reply, 70 );*/

$headers = "From: $email" . PHP_EOL;
$headers .= "Reply-To: $email" . PHP_EOL;
$headers .= "MIME-Version: 1.0" . PHP_EOL;
$headers .= "Content-type: text/plain; charset=utf-8" . PHP_EOL;
$headers .= "Content-Transfer-Encoding: quoted-printable" . PHP_EOL;

if(mail($address, $e_subject, $msg, $headers)) {

	// Email has sent successfully, echo a success page.

	echo "<fieldset>";
	echo "<div id='success_page'>";
	echo "<h1>Email Sent Successfully.</h1>";
	echo "<p>Thank you <strong>$name</strong>, your message has been submitted to us.</p>";
	echo "<p>We Will reply asap :)</p>";
	echo "</div>";
	echo "</fieldset>";

} else {

	echo 'ERROR!';

} is

jQuery(document).ready(function() {

    .on('click', function() {
      var btn = $(this);
      setTimeout(function() {
      }, 3000);

  $('#contactform').submit(function() {

    var action = $(this).attr('action');

    $("#message").slideUp(750, function() {
      $.post(action, {
          name: $('#name').val(),
          email: $('#email').val(),
          phone: $('#phone').val(),
          pdate: $('#pdate').val(),
          paddress: $('#paddress').val(),
          daddress: $('#daddress').val(),
          subject: $('#subject').val(),
          msg: $('#msg').val()
        function(data) {
          document.getElementById('message').innerHTML = data;
          if (data.match('success') != null)




    return false;



can anyone please help me with this ?

Thank you !

I’ve edited your post for readability by formatting it and removing some of the extra whitespace. In the future, when posting code, use the “preformatted text” button (it looks like </>) to make your code readable.

When I ran your code, there where PHP errors which need to be fixed.

You refer to a form input with id of paddress, but in your HTML form, you have an input with id of `paddess".

You refer to an input with id of subject, but I do not see an input with id of subject in your HTML form.

Lastly, you refer to an input with id of msg, but I do not see an input with id of msg in your HTML.

You should have seen these error messages when you run your code on the server. If you are not, you need to make sure to change your php.ini settings to display all errors.

@raz Forgot to mention that I added the preventDefault() to get your code to see the errors.

Thanks for mentioning that @kerafyrm02.

Thank you Everyone for your kind help,
i sorted this out as i missed adding the error message for some fields so there was the error.

Thank you Once again