ZF-5418: Improve Zend_Captcha usage example


It is not very clear from the Zend_Captcha documentation exactly how to validate submitted CAPTCHAs when using Zend_Captcha as a standalone component (i.e. without Zend_Form).

The code example on:… shows the following:

// On subsequent request:
// Assume captcha setup as before, and $value is the submitted value:
if ($captcha->isValid($_POST['foo'], $_POST)) {
    // Validated!

Without delving into the source code users have no way of knowing that $_POST['foo'] should be a key/value array containing the keys id (id of the generated captcha), and input (the string the user entered into a form). The comment also references the variable $value, which is never set or used (I believe this is leftover from before the 1.7 changes made as a result of issue #ZF-3995)

It would be useful if this example was extended to be a working example that included a basic HTML form showing the markup required.


Here's a working example based on the one currently in the docs.

thanks, I've changes the docs

Hi! The issue still exists, the docu was never updated

The lines 12-14 say: echo "

"; echo $captcha->render($view); echo "


But they lack the most important info:

The full example for the form is then:

echo "

"; echo $captcha->render($view); echo ''; echo ''; echo "


Please update the documentation, it took me two hours yesterday to figure that out.