Jose Johnson Pallikkathyil - 2012-03-26 04:35:48 -
In reply to message 2 from Jose Johnson Pallikkathyil
Sample code - - simple form with image captcha implementation.
Put the image cpatcha file (imagecaptcha.php) in same folder as this file
<?php
session_start();
$name="";
$age="";
$msg="";
if( $_POST['submit'] ){
$name=$_POST['txtname'];
$age=$_POST['txtage'];
if( trim($_POST['txtsecurity']) == trim( $_SESSION['security_code']) ){
$msg="Thanks, Your form is submitted";
}else{
//invalid security code
$msg="Sorry Security Code that you entered is incorrect.";
}
}
?>
<form action="" method="post">
<?php echo($msg); ?><br><br>
Enter Name : <input type=text name=txtname value="<?php echo($name) ?>" /><br>
Enter Age : <input type=text name=txtage <?php echo($age) ?> /><br>
Enter Security Code : <br>
<img src="imagecaptcha.php" /> : <input type=text name=txtsecurity /><br><br>
<input type=submit name=submit />
</form>