Note that there are some explanatory texts on larger screens.

plurals
  1. POPHP contact form emails to the email address, but 'name' field is empty?
    primarykey
    data
    text
    <p>No, I am new to this form!</p> <p>I have successfully set up a contact form page. It emails me the 'email address' and 'message' from the form fields, but does not send the name filed value, it is just blank.</p> <p>I cannot see where I have gone wrong. All the field names match up to the PHP file. Any ideas as to what I'm doing wrong?</p> <p>Here is my code:</p> <pre><code> &lt;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"&gt; &lt;!--MainDivStart--&gt; &lt;!-- HTML Frame - name txt_31 --&gt; &lt;!--Preamble--&gt; &lt;div style="position:absolute;left:8px;top:8px;width:51px;height:18px;overflow:hidden; /*BorderDivStyle*/" __AddCode="InsideBorderDiv"&gt; &lt;!--BorderDivContents--&gt; &lt;p class="Wp-Body-P"&gt;&lt;label for="edit_1"&gt;&lt;span class="Body-C"&gt;name&lt;/span&gt;&lt;/label&gt;&lt;/p&gt; &lt;/div&gt; &lt;!--Postamble--&gt; &lt;!-- Form Edit box edit_1 --&gt; &lt;!--Preamble--&gt; &lt;input type="text" id="edit_1" name="name" value="" style="position:absolute; left:103px; top:8px; width:50px; /*Tag Style*/" __AddCode="here"&gt; &lt;!--Postamble--&gt; &lt;!-- HTML Frame - email txt_32 --&gt; &lt;!--Preamble--&gt; &lt;div style="position:absolute;left:8px;top:38px;width:51px;height:18px;overflow:hidden; /*BorderDivStyle*/" __AddCode="InsideBorderDiv"&gt; &lt;!--BorderDivContents--&gt; &lt;p class="Wp-Body-P"&gt;&lt;label for="edit_19"&gt;&lt;span class="Body-C"&gt;email&lt;/span&gt;&lt;/label&gt;&lt;/p&gt; &lt;/div&gt; &lt;!--Postamble--&gt; &lt;!-- Form Edit box edit_19 --&gt; &lt;!--Preamble--&gt; &lt;input type="text" id="edit_19" name="email" value="" style="position:absolute; left:103px; top:38px; width:50px; /*Tag Style*/" __AddCode="here"&gt; &lt;!--Postamble--&gt; &lt;!-- HTML Frame - message txt_33 --&gt; &lt;!--Preamble--&gt; &lt;div style="position:absolute;left:8px;top:68px;width:79px;height:18px;overflow:hidden; /*BorderDivStyle*/" __AddCode="InsideBorderDiv"&gt; &lt;!--BorderDivContents--&gt; &lt;p class="Wp-Body-P"&gt;&lt;label for="text_2"&gt;&lt;span class="Body-C"&gt;message&lt;/span&gt;&lt;/label&gt;&lt;/p&gt; &lt;/div&gt; &lt;!--Postamble--&gt; &lt;!-- Text Area text_2 --&gt; &lt;!--Preamble--&gt; &lt;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"&gt;&lt;/textarea&gt; &lt;!--Postamble--&gt; &lt;!-- HTML Frame - captcha txt_34 --&gt; &lt;!--Preamble--&gt; &lt;div style="position:absolute;left:8px;top:114px;width:69px;height:18px;overflow:hidden; /*BorderDivStyle*/" __AddCode="InsideBorderDiv"&gt; &lt;!--BorderDivContents--&gt; &lt;p class="Wp-Body-P"&gt;&lt;label for="captcha_1"&gt;&lt;span class="Body-C"&gt;captcha&lt;/span&gt;&lt;/label&gt;&lt;/p&gt; &lt;/div&gt; &lt;!--Postamble--&gt; &lt;!-- Form CAPTCHA captcha_1 --&gt; &lt;!--Preamble--&gt; &lt;div style="position:absolute;left:103px;top:114px;width:190px;height:69px; /*MainDivStyle*/" __AddCode="here"&gt; &lt;!--MainDivStart--&gt; &lt;img src="http://www.serifwebresources.com/util/img_verify.php?gen_word=1&amp;id=captcha_1"&gt;&lt;br&gt;&lt;input type="text" id="captcha_1" name="captcha_1" size="20" __AddCode="here"&gt; &lt;a title="Listen to audio CAPTCHA" href="http://www.serifwebresources.com/util/audio/audio.php"&gt;&lt;img alt="Listen to audio CAPTCHA" style="vertical-align: middle" src="http://www.serifwebresources.com/media/icons/audio-desc.png" border="0"&gt;&lt;/a&gt;&lt;!--MainDivEnd--&gt; &lt;/div&gt; &lt;!--Postamble--&gt; &lt;!-- Form Button butn_4 --&gt; &lt;!--Preamble--&gt; &lt;input type="submit" style="position:absolute; left:8px; top:191px; width:81px; height:22px; /*Tag Style*/" value="Submit" __AddCode="here"&gt; &lt;!--Postamble--&gt; &lt;/form&gt; </code></pre> <p>code for PHP (mailform2.php):</p> <pre><code> &lt;?php $errors = ''; $myemail = 'myemail';//&lt;-----Put Your 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 a new message. ". " Here are the 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 to the 'thank you' page header('Location: contact-form-thank-you.html'); } ?&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload