My captcha script can be implemented in two steps:
Step1: Code for HTML Form
In the first step you need to enter a piece of code in your html form, in order to make the implementation of this captcha script easier I am using a dummy HTML form. The code is as follows:
<form action="" method="post" enctype="multipart/form-data" name="form1" id="form1"> <table width="100%" border="0"> <tr> <td>Select Name:</td> <td><label> <input type="text" name="test1" id="test1" /> </label></td> </tr> <tr> <td>Select Email:</td> <td><label> <input type="text" name="test2" id="test2" /> </label></td> </tr> <tr> <td colspan="2">Spam Check <?php $num1=rand(1,9); //Generate First number between 1 and 9 $num2=rand(1,9); //Generate Second number between 1 and 9 $captcha_total=$num1+$num2; echo $num1." + ".$num2; ?>= <label> <input name="captcha_entered" type="text" id="captcha_entered" size="5" maxlength="2" /> </label><input type="hidden" name="captcha_total" id="captcha_total" value="<?php echo $captcha_total; ?>" /></td> </tr> <tr> <td colspan="2"><label> <input type="submit" name="button" id="button" value="submit" /> </label></td> </tr> </table> </form>