Jump to content

Carrying form variables to captcha page not working...


Andrew777

Recommended Posts

Hello,
I was hoping someone could give me some advice on how to fix this problem..
 
I am trying to implement PHP Securimage captcha on one of my sites.
 
The thing is I have a Form (Page 1) and I am trying to carry my form variables (several) to the Captcha page (Page 2).
And then when the user answers the captcha properly the php code on that page sends me the form data.
 
The Form works fine if I keep captcha on the same page (I know how to do that), but I have a reason to separate the two. And what happens is I think i can get the variables over to the next page, but if someone doesn't answer the Captcha properly and the page RELOADS to show the "wrong captcha" message, I lose my form variables from the previous page...
 
 
So Form Page -> Captcha Page -> Sends Email.
 
I lose the carried over variables when the wrong captcha is entered and the user has to redo the captcha.
 
Captcha page has the following setup just showing one variable for brevity sake...
 
Form Page:

<form method="post" action="contact-captcha.php">
<input name="fullname" id="fullname" size="30" maxlength="40">
<input type="submit" value="Submit Info">
</form>

 

Captcha (contact-captcha.php) Page:

<?php session_start();

$fullname=$_REQUEST['fullname'];

if(isset($_REQUEST['sub']))
{
    include_once $_SERVER['DOCUMENT_ROOT'] . '/securimage/securimage.php';
    $securimage = new Securimage();

    if ($securimage->check($_POST['captcha_code']) == false) {
          
        $fullname = $_SESSION['fullname'];

 $msg1="-> Sorry, Wrong Verification Code Entered";
        }
    
    else
    {
 
    $fullname = $_SESSION['fullname'];

$mailmsg = '<table width="500px" border="0" align="center" cellpadding="0" cellspacing="0">
<tr><td></td>'.$fullname.'</tr></table>'

etc....

    }
  }
?>

<body>
<form name="form1" method="post" action="" onSubmit="return validate(this);">
<?php    
if(isset($msg1)) { echo "<br /><br /><span class='error'>".$msg1."</span><br /><br />"; }
else { echo '<br /><br />';}
?>
<img id="captcha" src="http://www.mysite.com/securimage/securimage_show.php" 
alt="CAPTCHA Image" />
<a href="#" onclick="document.getElementById('captcha').src = '/securimage/securimage_show.php?' + Math.random(); return false"><img src="images/reload.png" border="0" /></a>
<br><br>
Enter code: <input class="fields" type="text" name="captcha_code" size="15" maxlength="6" />
<input name="sub" id="sub" type="submit" value="Submit Info">
</form>
</body>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.