 <p>PHP is indeed a <strong>server-side</strong> application and thus cannot perform <strong>client-side</strong> validation. </p> <p>If you really want to do client-side validation, you'll probably have to use javascript. Have a look at the <a href="http://bassistance.de/jquery-plugins/jquery-plugin-validation/" rel="nofollow">jQuery validation plugin</a>. Here is a big demo page showing you some of the possibilities: <a href="http://jquery.bassistance.de/validate/demo/" rel="nofollow">http://jquery.bassistance.de/validate/demo/</a> </p> <p>For more help and information, also have a look at the <a href="http://docs.jquery.com/Plugins/Validation" rel="nofollow">jQuery.com/plugins/validation</a> page.<br> (Note the <strong>WARNING</strong> at the end of this post) </p> <p><strong>Example:</strong><br> (the javascript)</p> <pre><code>&lt;script&gt; $(document).ready(function(){ $("#commentForm").validate(); }); &lt;/script&gt; </code></pre> <p>(the form)</p> <pre><code>&lt;form class="cmxform" id="commentForm" method="get" action=""&gt; &lt;fieldset&gt; &lt;legend&gt;A simple comment form with submit validation and default messages&lt;/legend&gt; &lt;p&gt; &lt;label for="cname"&gt;Name&lt;/label&gt; &lt;em&gt;*&lt;/em&gt;&lt;input id="cname" name="name" size="25" class="required" minlength="2" /&gt; &lt;/p&gt; &lt;p&gt; &lt;label for="cemail"&gt;E-Mail&lt;/label&gt; &lt;em&gt;*&lt;/em&gt;&lt;input id="cemail" name="email" size="25" class="required email" /&gt; &lt;/p&gt; &lt;p&gt; &lt;label for="curl"&gt;URL&lt;/label&gt; &lt;em&gt; &lt;/em&gt;&lt;input id="curl" name="url" size="25" class="url" value="" /&gt; &lt;/p&gt; &lt;p&gt; &lt;label for="ccomment"&gt;Your comment&lt;/label&gt; &lt;em&gt;*&lt;/em&gt;&lt;textarea id="ccomment" name="comment" cols="22" class="required"&gt;&lt;/textarea&gt; &lt;/p&gt; &lt;p&gt; &lt;input class="submit" type="submit" value="Submit"/&gt; &lt;/p&gt; &lt;/fieldset&gt; &lt;/form&gt; </code></pre> <p><strong>WARNING</strong><br> Please keep in mind that javascript, being <em>client-side</em>, runs on the client's computer. Don't rely on javascript validation alone. Anyone can disable javascript and insert 'wrong' values in your form.</p>