please help me, need help with captcha

hey guys, so i have a contact form which is validated with a captcha system i have made, here is the code:
// code for captcha
// this is starting the session made in generate.php and making it so the numbers generated are between
// 1000-9999
// we do a if statement so that it links to the submit button and if entered incorrectly it outputs
// and refreshes the image to a new one.
if (!isset($_POST[‘secure’]) ){
if ($_SESSION[‘secure’] == $_POST[‘secure’]){
echo"incorrect captcha code";


Send an e-mail

* Name:
Company Name:
* Email:
* Message:


now when i enter the correct captcha, all goes well, and when i enter the wrong captcha, again all goes well as it outputs a message saying the captcha code is wrong. this is because the form action is set to the current page. but when i put the actualy redirect action to “sent.php”, no matter if i put the correct/wrong captcha code, it still redirects me to the page “sent.php” . how do i make it so it only redirects to that page IF the captcha code is correct.

thanks alot.

Read this…

And incorporate it like this…

[php] if ($_SESSION[‘secure’] == $_POST[‘secure’]){
echo"incorrect captcha code";

Sponsor our Newsletter | Privacy Policy | Terms of Service