I'm trying to use the Securimage PHP script (cf google) for CAPTCHA's but I have a problem: when I press the link "Different image" (to display another captcha), I lose all the text that was entered in the fields of my PHP form. So a user would have to re-enter everything again, which is problematic.
Here is the code. Note: I took away the '#' for the href because for some reason, it fails in changing the captcha image. Does anyone know why? (this happens in both Safari and Firefox)
<img id='captcha' src='/myproject/securimage/securimage_show.php' alt='CAPTCHA Image' /><br> <a href='' onclick='document.getElementById('captcha').src = '/securimage/securimage_show.php?' + Math.random(); return false'> [Different Image ]</a>
Because you have removed '#' from href thats why whole page is refreshed when the link is clicked and all fields data is lost. don't remove it, and then use following code
<img id='captcha' src='/myproject/securimage/securimage_show.php' alt='CAPTCHA Image' />
<br>
<a href="#" onclick="document.getElementById('captcha').src = '/securimage/securimage_show.php?' + Math.random(); return false;"> [Different Image ]</a>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With