html - PHP contact form emails to the email address, but 'name' field is empty? -


no, new form!

i have set contact form page. emails me 'email address' , 'message' form fields, not send name filed value, blank.

i cannot see have gone wrong. field names match php file. ideas i'm doing wrong?

here code:

   <form id="form_28" name="website_query" action="mailform2.php" accept-charset="utf-8" method="post" target="_self" enctype="multipart/form-data" style="margin:0;position:absolute;left:231px;top:242px;width:343px;height:229px; /*maindivstyle*/" __addcode="here"> <!--maindivstart-->   <!-- html frame - name txt_31 -->  <!--preamble--> <div style="position:absolute;left:8px;top:8px;width:51px;height:18px;overflow:hidden; /*borderdivstyle*/" __addcode="insideborderdiv"> <!--borderdivcontents--> <p class="wp-body-p"><label for="edit_1"><span class="body-c">name</span></label></p> </div> <!--postamble-->   <!-- form edit box edit_1 -->  <!--preamble--> <input type="text" id="edit_1" name="name" value="" style="position:absolute; left:103px; top:8px; width:50px; /*tag style*/" __addcode="here"> <!--postamble-->   <!-- html frame - email txt_32 -->  <!--preamble--> <div style="position:absolute;left:8px;top:38px;width:51px;height:18px;overflow:hidden; /*borderdivstyle*/" __addcode="insideborderdiv"> <!--borderdivcontents--> <p class="wp-body-p"><label for="edit_19"><span class="body-c">email</span></label></p> </div> <!--postamble-->   <!-- form edit box edit_19 -->  <!--preamble--> <input type="text" id="edit_19" name="email" value="" style="position:absolute; left:103px; top:38px; width:50px; /*tag style*/" __addcode="here"> <!--postamble-->   <!-- html frame - message txt_33 -->  <!--preamble--> <div style="position:absolute;left:8px;top:68px;width:79px;height:18px;overflow:hidden; /*borderdivstyle*/" __addcode="insideborderdiv"> <!--borderdivcontents--> <p class="wp-body-p"><label for="text_2"><span class="body-c">message</span></label></p> </div> <!--postamble-->   <!-- text area text_2 -->  <!--preamble--> <textarea id="text_2" name="message" rows="2" cols="10" style="position:absolute; left:103px; top:68px; width:100px; height:38px; /*tag style*/" __addcode="here"></textarea> <!--postamble-->   <!-- html frame - captcha txt_34 -->  <!--preamble--> <div style="position:absolute;left:8px;top:114px;width:69px;height:18px;overflow:hidden; /*borderdivstyle*/" __addcode="insideborderdiv"> <!--borderdivcontents--> <p class="wp-body-p"><label for="captcha_1"><span class="body-c">captcha</span></label></p> </div> <!--postamble-->   <!-- form captcha captcha_1 -->  <!--preamble--> <div style="position:absolute;left:103px;top:114px;width:190px;height:69px; /*maindivstyle*/" __addcode="here"> <!--maindivstart-->     <img src="http://www.serifwebresources.com/util/img_verify.php?gen_word=1&id=captcha_1"><br><input type="text" id="captcha_1" name="captcha_1" size="20" __addcode="here">     <a title="listen audio captcha" href="http://www.serifwebresources.com/util/audio/audio.php"><img alt="listen audio captcha" style="vertical-align: middle" src="http://www.serifwebresources.com/media/icons/audio-desc.png" border="0"></a><!--maindivend--> </div> <!--postamble-->   <!-- form button butn_4 -->  <!--preamble--> <input type="submit" style="position:absolute; left:8px; top:191px; width:81px; height:22px; /*tag style*/" value="submit" __addcode="here"> <!--postamble--> </form> 

code php (mailform2.php):

  <?php  $errors = ''; $myemail = 'myemail';//<-----put email address here. if(empty($_post['name'])  ||     empty($_post['email']) ||     empty($_post['message']))  $name = $_post['name'];  $email = $_post['email'];  $message = $_post['message'];    if( empty($errors)) {     $to = $myemail;      $email_subject = "website query: $name";     $email_body = "you have received new message. ".     " here details:\n name: $name \n email: $email \n message \n $message";       $headers = "from: $myemail\n";      $headers .= "reply-to: $email";      mail($to,$email_subject,$email_body,$headers);     //redirect 'thank you' page     header('location: contact-form-thank-you.html'); }  ?> 

if(empty($_post['name'])  ||     empty($_post['email']) ||     empty($_post['message']))  $name = $_post['name'];  

in above code if post of name,email , message empty, set name = $_post['name'];

so $name variable not set.

so code these

    if(empty($_post['name'])  ||             empty($_post['email']) ||             empty($_post['message'])) {         $errors = 'please enter required fields';     }     else     {      $name = $_post['name'];       $email = $_post['email'];       $message = $_post['message'];    }  

Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -