/    Sign up×
Community /Pin to ProfileBookmark

[RESOLVED] Captcha refreshing problem in PHP form

Hello,

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)

[code=php]
<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>
[/code]

If anyone could tell me what the problem is, I would really appreciate it.

Thank you very much

to post a comment
PHP

2 Comments(s)

Copy linkTweet thisAlerts:
@hyperionXSFeb 27.2012 — You have an error in javascript code
[CODE]
'document.getElementById('captcha').src = '/securimage/securimage_show.php?' + Math.random(); return false'
[/CODE]

use double quotes for begin and end
[CODE]
"document.getElementById('captcha').src = '/securimage/securimage_show.php?' + Math.random(); return false"
[/CODE]
Copy linkTweet thisAlerts:
@eric01authorFeb 28.2012 — Ah great, that was the problem!

Cheers
×

Success!

Help @eric01 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 4.29,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...