I'm loving FormHandler, but I can't get a captcha field to work. I tried it in a form I had made which was working fine and when I included the captcha code none of the form displayed. So now I'm using the code straight from the manual, the only thing I change is the path to the class. I use this path in the code of the form that works without the captcha field, so I know it is correct.
When I use this code, nothing at all displays in the browser.
<?php
// include the class
include("../../FormHandler/class.FormHandler.php");
echo "here";
// make a new $oForm object
$oForm = new FormHandler();
// a textfield
$oForm->CaptchaField("Verify the code", "code");
// submitbutton beneath it
$oForm->submitButton("Save");
// set the 'commit after form' function
$oForm->onCorrect("FH_RUN");
// send the form to the screen
$oForm->flush();
// function to show a message
function FH_RUN($aData)
{
return "You entered the correct code ". $aData["code"];
}
?>
Changed at 22 February 09 / 20:13
I did copy your exact code to here http://www.jwiegel.com/FH/test.php
if you visit this url can you see the captcha code?
I had exactly the same. Check your HTML source. The reference to the image is probably not correct.
FH_FHTML_DIR, in my case (IIS shared server) referenced to E:\wwwroot\etc., so a no go. $_SERVER['...'] the same.
I hardcoded the path 'FHTML/securimage/securimage.php', for testing, and voila. This works if the testing file is in the same folder as class.FormHandler.php, obviously.