![Picture of Albert Padley Picture of Albert Padley](/graphics/unknown.gif)
Albert Padley - 2006-08-05 17:53:28
I have an existing form that I am trying to add a Captcha input to. The Captcha image does not display.
When accessing the test_captcha_form.php page, the Captcha image does display. So, the problem is not with GD or mcrypt.
I copied the following code from the test_captcha_form.php page and pasted it into my existing form page.
At the top of the page:
require("form_captcha.php");
$key="my secret key"; // Tried various keys
In the define fields section:
$error=$form->AddInput(array(
"TYPE"=>"custom",
"ID"=>"captcha",
"LABEL"=>"<u>E</u>nter the following text:",
"ACCESSKEY"=>"E",
"CustomClass"=>"form_captcha_class",
"Key"=>$key,
/* "Format"=>"{image} {text} {redraw}{validation}", */
/* "ImageWidth"=>80, */
/* "ImageHeight"=>20, */
/* "TextLength"=>4, */
/* "TextColor"=>"#000000", */
"ImageFormat"=>"png",
"NoiseFromPNGImage"=>"noise.png",
/*
* If you have installed GD with GIF support, you may uncomment these
* lines.
*/
/* "ImageFormat"=>"gif", */
/* "NoiseFromGIFImage"=>"noise.gif", */
"ResetIncorrectText"=>1,
"BackgroundColor"=>"#FFFFFF",
"ValidationErrorMessage"=>"The validation text is not correct. Please enter it again.",
"ExpiryTime"=>60,
"ExpiryTimeValidationErrorMessage"=>"The validation text has expired."
));
if(strlen($error))
die("Error: ".$error);
At the end of the define fields section:
/*
* This code is necessary to handle the requests for serving the captcha
* image.
* Do not remove it nor output any data or headers before these lines.
*/
$form->HandleEvent($processed);
if($processed)
exit;
Did I miss something?
The form can be seen at www.billgarrettconstruction.com/formsgen/projectform.php
Thanks.