I’m having a problem with captcha code. I keep getting the echo message “CAPTCHA CODE does not match!” everytime I send it . What am I not seeing? Please open my eyes to the error. Thanks in advance.
[php]<?php
session_start();
include “config.php”;
$id = (int)$_GET[‘id’];
$res = mysql_query($query, $bd);
$id = (int)$_GET[‘id’];
$id = substr($id, 0,5);
if($id < 1 || $id > 99999) exit;
$query = “SELECT * FROM units
WHERE id
= $id”;
$res = mysql_query($query, $bd);
$result = mysql_fetch_assoc($res);
$contact = $result[‘contact’];
$phone = $result[‘phone’];
$var = $result[‘email’];
if (!empty($var)) {
if (isset($_POST[‘submit’])) {
if(($_SESSION[‘security_code’] == $_POST[‘security_code’]) && (!empty($_SESSION[‘security_code’])) ) {
$to = “$var”; // change to your email address
$name = htmlentities ($_POST[‘name’]);
$email = htmlentities ($_POST[‘email’]);
$phone = htmlentities ($_POST[‘phone’]);
$msg = htmlentities ($_POST[‘msg’]);
$d = date(‘l dS \of F Y h:i:s A’);
$sub = “My Domain RE:”.$result[‘title’]."";
$headers = “From: $name <$email>\n”;
$headers .= “Content-Type: text/plain; charset=iso-8859-1\n”;
$mes = “phone: “.$phone.”\n”;
$mes .= “Message: “.$msg.”\n”;
$mes .= “Name: “.$name.”\n”;
$mes .= 'Email: '.$email."\n";
$mes .= 'Date & Time: '.$d;
mail($to, $sub, $mes, $headers);
echo “<div align='left’Email Has Been Sent”;
} else {
echo "<div align='left’CAPTCHA CODE does not match! ";
}
}
echo "
";}?>[/php]