Jump to content


Photo

Feedback form help with (captcha)


  • Please log in to reply
No replies to this topic

#1 AdRock

AdRock
  • Members
  • PipPipPip
  • Advanced Member
  • 911 posts

Posted 26 July 2006 - 02:26 PM

I have a feedback form where the user has to enter a captcha images to send.

If the user doesn't fill out any text fields but does complete the captcha image correctly, a blank email is getting sent and I get this error message but if the user does complete the form correclty the email is sent.

Warning: Cannot modify header information - headers already sent by (output started at /home/adrock/public_html/jack/includes/captcha.php:24) in /home/adrock/public_html/jack/includes/captcha.php on line 51

I need some sort of vaildation where if there is any blank fields the form is shown and a message saying which field requires entry

The feedback form is displayed in index.php?page=contact

captcha.php
<?
// *** The CAPTCHA comparison - http://frikk.tk ***
session_start();

// *** We need to make sure theyre coming from a posted form -
//	If not, quit now ***
if ($_SERVER["REQUEST_METHOD"] <> "POST")
	die("You can only reach this page by posting from the html form");

// *** The text input will come in through the variable $_POST["captcha_input"],
//	while the correct answer is stored in the cookie $_COOKIE["pass"] ***
if ($_POST["captcha_input"] == $_SESSION["pass"])

{
$myemail = "me@myemail.co.uk"; 
$ccx = ""; 

if(!$visitormail == "" && (!strstr($visitormail,"@") || !strstr($visitormail,"."))) 
{
echo "<h2>Use Back - Enter valid e-mail</h2>\n"; 
$badinput = "<h2>Feedback was NOT submitted</h2>\n";
}
if(empty($visitor) || empty($visitormail) || empty($notes )) {
echo "<h2>Use Back - fill in all fields</h2>\n";
}
echo $badinput;

$todayis = date("l, F j, Y, g:i a") ;

$subject = $attn; 

$notes = stripcslashes($notes); 

$message = " $todayis [EST] \n
Message: $notes \n 
From: $visitor ($visitormail)\n
Additional Info : IP = $ip \n
Browser Info: $httpagent \n
";

$from = "From: $visitormail\r\n";

if (($ccopy == "ccyes") && ($visitormail != "")) 
mail($visitormail, $subject, $message, $from);

if ($myemail != "") 
mail($myemail, $subject, $message, $from);

if ($ccx != "") 
mail($ccx, $subject, $message, $from);
header('Location: http://www.mysite.co.uk/jack/index.php?page=thankyou');
}
else 
{header('Location: http://www.mysite.co.uk/jack/index.php?page=contact');
}
?>

Anyone have any ideas how i can do this
If your topic has been solved, please mark the topic as SOLVED.

This helps others from identifying which topics need help still




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users