hey guys, so i have a contact form which is validated with a captcha system i have made, here is the code:
[php]<?php
// code for captcha
session_start();
// 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’]) ){
$_SESSION[‘secure’]=rand(1000,9999);
}else{
if ($_SESSION[‘secure’] == $_POST[‘secure’]){
}else{
echo"incorrect captcha code";
$_SESSION[‘secure’]=rand(1000,9999);
}
}
?>
Send an e-mail
* Name: |
Company Name: |
* Email: |
Subject: |
* 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.