Problem with a code.Please help!

I am working on my own project to make a blog for my personal use.

Now the problem is when i press the submit button the captcha works but it doesnt stop sql database update query from executing. so basically what i want is that if the captcha is entered incorrectly it will redirect back to the form page and reset it and will not add the entered record into the database as the captcha entered was invalid.
Please help
I am posting a code snippet

[php]


Name


A value is required.



Email ID


A value is required.



Comment:


A value is required.


<?php session_start() ?>

Enter 3 black symbols
captcha image
<?php if(isset($_POST["captcha"])) if($_SESSION["captcha"]==$_POST["captcha"]) { echo $editFormAction; //CAPTHCA is valid; proceed the message: save to database, send by e-mail ... echo 'CAPTCHA is valid'; } else { echo 'CAPTCHA is not valid'; } ?>
 <p>
   <input type="hidden" name="MM_insert" value="form1" />
</p>
</form>
<p>

[/php]

Sponsor our Newsletter | Privacy Policy | Terms of Service