Show message for empty form field?
<p>I'm trying to get the optin form on my website to not send empty fields.  </p>

<p>I also have predefined text within the form fields (Ex. "Enter you name here" ) that disappears on click.  I don't want the form to send predefined text data either.</p>

<p>What is the best way to go about this with PHP?</p>

<p>HTML:</p>

<pre><code>&lt;div class="form"&gt;
&lt;h2&gt;Get An Appointment: &lt;font size="3"&gt;&lt;font color="#6E5769"&gt;Fill in the form below now, and I'll call you to setup your next dental appointment...&lt;/font&gt;&lt;/font&gt;&lt;/h2&gt;
&lt;p id="feedback"&gt;&lt;?php echo $feedback; ?&gt;&lt;/p&gt;
&lt;form action="contact.php" method="post"/&gt;
&lt;p class="name"&gt;
&lt;input type="text" name="name" id="name" style="text-align:center;" onClick="this.value='';" value="Enter your name"/&gt;
</code></pre>

<p></p>
    <br>
    
    </p>
    
    
    </p>
    </p>

<p>PHP:</p>

<pre><code>&lt;?php

$to = 'test@mywebsite.com'; $subject = 'New Patient';

$name = $_POST['name']; $phone = $_POST['phone'];

$body = &lt;&lt;&lt;EMAIL

Hi, my name is $name, and phone number is $phone.

EMAIL;

$header = 'From: test@mywebsite.com';

if($_POST){ if($name != '' &amp;&amp; $phone != ''){ mail($to, $subject, $body, $header); }else{ $feedback = 'Fill out all the fields'; } } ?&gt;
</code></pre>
