I'm trying to implement a captcha system, and I found a nice and very simple class trough google that does what I want.
it's something like:
$captcha = new Captcha();
$prefix = mt_rand();
$image = $captcha->generate($prefix);
then I add the image in the form:
<img src="<?php echo $image; ?>" />
<input name="captcha" type="text" value="Type the security code from above" />
it works fine so far, but I don't know how to check if the submitted code matches the captcha. In the documentation, it says I have to do it with:
$correct = $captcha_instance->check($prefix, $_POST['captcha']);
but the problem is that after the form is submitted $captcha
and $prefix
are gone...
How do I pass these variables after the form is submitted to the next page?