Note that there are some explanatory texts on larger screens.

plurals
  1. POContact form - Checking if the user had completed all the fields
    primarykey
    data
    text
    <p>I have this contact form on my website, but I can't make it to check if the form fields were completed.</p> <pre><code>&lt;form id="cform" name="cform" method="post" action="&lt;?php bloginfo('template_directory'); ?&gt;/cform.php"&gt; &lt;div id="nande"&gt; &lt;p&gt;&lt;input type="text" id="name" name ="name"; onfocus="if(this.value=='Your Name is')this.value='';" onblur="if(this.value=='')this.value='Your Name is';" alt="Your Name" value="Your Name is"/&gt;&lt;/p&gt; &lt;p&gt; &lt;input type="text" id="e-mail" name="mail" onfocus="if(this.value=='Your Email is')this.value='';" onblur="if(this.value=='')this.value='Your Email is';" alt="Your Email" value="Your Email is"/&gt;&lt;/p&gt; &lt;/div&gt; &lt;div class="clear"&gt;&lt;/div&gt; &lt;p&gt;&lt;textarea name="message" rows="4" id="comments" tabindex="4" title="comments" onfocus="if(this.value=='Your Message is')this.value='';" onblur="if(this.value=='')this.value='Your Message is';""&gt;Your Message is&lt;/textarea&gt;&lt;/p&gt; &lt;div class="clear"&gt;&lt;/div&gt; &lt;p&gt;&lt;input name="submit" type="submit" value="SEND" id="submit"/&gt;&lt;/p&gt; &lt;/form&gt; </code></pre> <p>Below is the PHP for the form</p> <pre><code>&lt;?php if(isset($_POST['submit'])) { $to = 'email@address.com' ; //put your email address on which you want to receive the information $subject = 'designdone project email'; //set the subject of email. $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; $message = "&lt;table&gt;&lt;tr&gt;&lt;td&gt;Your Name&lt;/td&gt;&lt;td&gt;".$_POST['name']."&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt;&lt;td&gt;E-Mail&lt;/td&gt;&lt;td&gt;".$_POST['email']."&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt;&lt;td&gt;Message&lt;/td&gt;&lt;td&gt;".$_POST['message']."&lt;/td&gt; &lt;/tr&gt;&lt;/table&gt;" ; mail($to, $subject, $message, $headers); header( 'Location: http://designdone.com' ) ; } ?&gt; </code></pre> <p>How can I check to see if the user completed the form and doesn't send an empty form?</p> <p>Thank you for your help.</p>
    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