javascript - php mail with .js validation -> can't see any mistakes -


i got piece of code free template , followed instructions came it, seems fine mail doesn't go trough. html:

                <!--start contact form -->                                                       <form name="enq" method="post" action="email/" onsubmit="return validation();">   <fieldset>      <input type="text" name="name" id="name" value=""  class="input-block-level" placeholder="name.." />     <input type="text" name="email" id="email" value="" class="input-block-level" placeholder="email.." />     <textarea rows="11" name="message" id="message" class="input-block-level" placeholder="message.."></textarea>     <div class="actions">     <input type="submit" value="send!" name="submit" id="submitbutton" class="btn btn-info pull-right" title="send!" />     </div>      </fieldset> </form>                               <!--end contact form --> 

php

    <?php  if(isset($_post['submit']))  {     $name = $_post['name'];     $email = $_post['email'];     $query = $_post['message'];     $email_from = $name.'<'.$email.'>';   $to="email@sample.com";  $subject="enquiry!";  $headers  = 'mime-version: 1.0' . "\r\n";  $headers .= 'content-type: text/html; charset=iso-8859-1' . "\r\n";  $headers .= "from: ".$email_from."\r\n";  $message="              name:          $name               <br>          email-id:          $email                  <br>          message:          $query             ";     if(mail($to,$subject,$message,$headers))         header("location:../contact.php?msg=successful submission! thankyou contacting us.");     else         header("location:../contact.php?msg=error send email !");         //contact:-your-email@your-domain.com  } ?> 

javascript

 function validation()  {      var contactname=document.enq.name.value;     var name_exp=/^[a-za-z\s]+$/;     if(contactname=='')     {         alert("name field should not empty!");         document.enq.name.focus();         return false;     }     else if(!contactname.match(name_exp))     {         alert("invalid name field!");         document.enq.name.focus();         return false;     }      var email=document.enq.email.value;     //var email_exp=/^[a-za-z0-9\.-_\$]+@[a-za-z]+\.[a-z]{2,4}$/;     var email_exp=/^\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/;     if(email=='')     {         alert("please enter email-id!");         document.enq.email.focus();         return false;     }     else if(!email.match(email_exp))     {         alert("invalid email id !");         document.enq.email.focus();         return false;     }       var message=document.enq.message.value;     if(message=='')     {         alert("query field should not empty!");         document.enq.message.focus();         return false;     }     return true;  } 

i don't errors mail doesn't go trough, checked spam etc.

i hope changed

$to="email@sample.com"; 

to actual e-mail.. can't see else.


Comments

Popular posts from this blog

jquery - How do you format the date used in the popover widget title of FullCalendar? -

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -