Validating a field with jQuery : <p>I am trying to validate a form field so that the post won't proceed if the field is set with a value. So my field is:</p>

<pre><code> &lt;input type="text" name="validator" id="validator" value="" title="validator" class="myClass" /&gt;
</code></pre>

<p>and then I'm using the following snippet to check if it has been filled:</p>

<pre><code> jQuery("form").submit(function(){
     &lt;?php if(isset($_POST['validator']) || !empty($_POST['validator'])){
                        die("Unable to write to database");
                        }

                ?&gt;
      });
</code></pre>

<p>but when I hit the submit button the form continues and registers the new user.  What't wrong with my code please ? </p>
