title: Validate before post
body: <p>I have this little code (part of my registration code) :</p>
  
  <pre><code>&lt;?php 
   if (@$_POST['Submit'] == 'Register'){
  
       if (strcmp(md5($_POST['user_code']),$_SESSION['ckey']))
      { 
           die("Invalid code entered. Please enter the correct code as shown in the Image");
      } 
   } 
   ?&gt; 
  
  &lt;form name="form1" id="signupForm" method="post" action="register.php" style="padding:5px;"&gt;
  &lt;div class="reg_left"&gt;Security code:&lt;/div&gt;
  &lt;div class="reg_right"&gt;&lt;input name="user_code" type="text" size="10"&gt; &lt;img src="pngimg.php" align="middle" width="100" height="40"&gt;&lt;/div&gt;
  &lt;div&gt;&lt;input type="submit" name="Submit" class="submit" value="&lt;?php echo $gomb_reg;?&gt;"&gt;&lt;/div&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>Unfortunately this is check if code is valid after post the form data. I would like to check before posting. </p>
  
  <p>So I think I must use jQuery validation plugin (btw I use jQuery to validate the other fields like email, user, password). But as I'm not an expert in jQuery, I need help to write that php code above in jQuery.</p>
  
  <p>Thank you.</p>