-1

HTML Codes

                        <h3>online consultation</h3>

                        <h5>We have provided contact information down below. You can contact us either by mobile, via email or via contact form. We will at once contact you to discuss your problems! If you have special requirments a consultation can be decided.</h5>


                        </div>


                                  <div class="col-md-7 col-lg-offset-3 contact-grid-right">                     

                             <form  method="post" action="mail.php">

                               <input type="text" placeholder="Your Name" name="name" id="name" required="required">

                               <input type="text" placeholder="Email" name="Email" id="Email" required="required">

                                   <input type="text" placeholder="Contact No" name="contact" id="contact" required="required">

                              <input type="text" placeholder="Subject"  name="subject" id="subject" required="required">

                              <textarea rows="2" cols="70" type="text" placeholder="MESSAGE"  name="message" id="message" required="required">

                                                           </textarea>


                          <button type="submit" class="slide-btn"> Send your message <i class="fa fa-paper-plane" aria-hidden="true"></i> <br></button>                                 


                         </form>


                         </div>

PHP Script

<?php

$n=$_POST['name'];
$mail=$_POST['email'];
$ph=$_POST['contact'];
$ln=$_POST['subject'];
$msg=$_POST['message'];
$to="email@yahoo.com";
$sub="message";

$body="
<html>
    <body>
        <p><b></b></p><h4></h4>
        <table border='0'>
            <tr>
                <b>Name : </b> $n <br><br>
                <b>Email : </b> $mail <br><br>
                <b>Contact :</b> $ph  <br><br>
                <b>Subject :</b> $ln <br><br>
                <hr>
                <b>Contact Form Message:</b> <br><br>$msg 
            </tr>
        </table>
    </body>
</html>";


$headers = "MIME-Version: 1.0". "\r\n";

$headers .= "Content-type:text/html;charset=UTF-8". "\r\n";

$headers .= 'From:'.$mail . "\r\n";

//$headers .= 'Cc: email@yahoo.com.au'; "\r\n";

//$headers .= 'Bcc: '; "\r\n";

mail($to,$sub,$body,$headers);

//echo "<script>alert('Message Send Sucessfully')</script>";

echo "<script>window.location.href='index.html'</script>";



?>
Funk Forty Niner
  • 74,450
  • 15
  • 68
  • 141
Aryan
  • 1
  • 3

2 Answers2

0

here the solution change the $mail=$_POST['email']; in your php script to $mail=$_POST['Email'];

  • Ok, so I have finally discovered the problem! It is - when I am putting '@' in the box in the contact form I do not receiving any message to my webmail but when I drop '@' the whole message of the contact form arrive my web mail. what's this strange problem???? – Aryan Aug 24 '17 at 11:41
0

For keeping your code standard replace the email html input for:

<input type="text" placeholder="Email" name="email" id="email" required="required">
perodriguezl
  • 430
  • 3
  • 13