Hi Everybody,
I have a form, and to be fancy I wanted to include a simple security snippet:
<?php $firstnumb = rand(1,9); $secondnumb = rand(1,99); $entry = $firstnumb + $secondnumb; print $firstnumb + $secondnumb ?>Then I have a simple <input type=“text” where a visitor can simply add the value of $firstnumb to the value of $secondnumb enter the numerical answer a textbox named “entry1”.
Now I need to compare the value of entry1 to the value of $entry.
If the values compare, then I would like to process the action described in the form element:
If the values do not compare, then I want to:
- Delete the value entered for entry1
- Alert the visitor that the answer wasn’t correct.
- Return focus to the empty entry1 text box
How can I approach this?
Many Thanks,
Paul