captcha warning not working

Got rid of the error message many thanks to Redscouse, and it now works but if you don’t enter the right Captcha code the warning message, Sorry “you have provided an invalid security code” dose not work the page just goes to the home page and I cant see why

[php]<?php session_start();
if(($_SESSION[‘security_code’] == $_POST[‘security_code’]) && (!empty($_SESSION[‘security_code’])) ) {
// Insert you code for processing the form here, e.g emailing the submission, entering it into a database.
$fromemail=“No-Reply [email protected]”; // change here if you want
$toemail="[email protected]"; // change here if you want
$sub=“Online Feedback”; // change here if you want
$success_page_name=“success.html”;
////// do not change in following

unset($_SESSION['security_code']);

}else { “Sorry, you have provided an invalid security code”;

}

////// do not change in following
if($_SERVER[‘REQUEST_METHOD’]==“POST”){

$fieldnm_1=str_replace ( array("\n"), array("
"),trim($_REQUEST[‘fieldnm_1’]));
$fieldnm_2=str_replace ( array("\n"), array("
"),trim($_REQUEST[‘fieldnm_2’]));
$fieldnm_3=str_replace ( array("\n"), array("
"),trim($_REQUEST[‘fieldnm_3’]));
$fieldnm_4=str_replace ( array("\n"), array("
"),trim($_REQUEST[‘fieldnm_4’]));
$fieldnm_5=str_replace ( array("\n"), array("
"),trim($_REQUEST[‘fieldnm_5’]));
$fieldnm_6=str_replace ( array("\n"), array("
"),trim($_REQUEST[‘fieldnm_6’]));
$fieldnm_7=str_replace ( array("\n"), array("
"),trim($_REQUEST[‘fieldnm_7’]));
$fieldnm_8=str_replace ( array("\n"), array("
"),trim($_REQUEST[‘fieldnm_8’]));
$fieldnm_9=str_replace ( array("\n"), array("
"),trim($_REQUEST[‘fieldnm_9’]));
$fieldnm_10=str_replace ( array("\n"), array("
"),trim($_REQUEST[‘fieldnm_10’]));

$contentmsg=stripslashes("
$sub

First Name *: $fieldnm_1
Last name *: $fieldnm_2
House name or number *: $fieldnm_3
Address: $fieldnm_4
Address: $fieldnm_5
Address: $fieldnm_6
Post code *: $fieldnm_7
Phone Number *: $fieldnm_8
Email *: $fieldnm_9
Comments : $fieldnm_10
");

////
$headers = "MIME-Version: 1.0
";
$headers .= "Content-type: text/html; charset=iso-8859-1
";

$from=$fromemail;

$headers .= "From: “.$from.”
";

@mail($toemail,$sub,$contentmsg,$headers);

header(“Location:$success_page_name”);
}?>[/php]

Unless its located elsewhere, I don’t see anything for that security code on that form. and you’re email code is in the wrong place.

Sponsor our Newsletter | Privacy Policy | Terms of Service