View Full Version : Form2Mail and Captcha Image

03-18-2009, 07:29 PM

I found a Captcha image verification code at phpjabbers.com and have the random numbers image appear on my site's contact.html page which is pretty cool but I have a problem getting their submit.php code to work with the Form2Mail.php action on my Contactus.html form.

Currently, if the vistor inputs the Captcha image number incorrectly the email is still sent to my email Inbox. I am not sure how to link the Captcha's submit.php with my form2mail.php my contact.html Submit button.

PHPJabber's sample form php code
<form action="submit.php" method="post">
Comment: <textarea name="coment"></textarea><br>
Enter Code <img src="captcha.php"><input type="text" name="vercode" /><br>
<input type="submit" name="Submit" value="Submit" />

PHPJabbers Submit.php
if ($_POST["vercode"] != $_SESSION["vercode"] OR $_SESSION["vercode"]=='') {
echo '<strong>Incorrect verification code.</strong><br>';
} else {
// add form data processing code here
echo '<strong>Verification successful.</strong><br>';

I could post the Form2Mail.php code but I am sure you have seen a couple copies of it already. I am not a programmer and could use your assistance. Thank you.


03-19-2009, 01:00 AM
session_start(); must be at the top of your 'action page (mail script)
and bascically
if ($_POST["vercode"] != $_SESSION["vercode"] OR $_SESSION["vercode"]=='') {
echo '<strong>Incorrect verification code.</strong><br>';
must be intergrated into your validation section of it