above is the js code I use to generate a random id, which in effect displays id.jpg on the web page (assume we have id.jpg in the right folder).
When a user sees that page, he is going to choose what word describes the picture best. (purpose of CAPTCHA: verify the user is a human)
<select name="selected"><option value="">Click to identify</option><option>Clock</option><option>Dog</option><option>Ship</option><option>Tree</option></select></td><td>
The selection is sent to backend php script using POST method.
Here is my problem:
In the php script, I know, for example, the user chose Dog to describe the mysterious jpg generated by js code. But there's no way for me to know the id of the jpg file generated by js code. Hence, I will not be able to check whether the user chose a valid description of the jpg file.
How can I send information about the id of the jpg file to the php script?
Basically, you need to also write that number out to a (hidden) form field, so that it gets submitted alongside the rest of the form.
One work of warning though - make sure that the OPTIONS in the SELECT are not in the same order as the images, and ideally have more than one image for each 'type', so that it really can't be worked out by a computer.