Jump to content

Feedback form help with (captcha)


AdRock

Recommended Posts

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.

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

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
[code]<?
// *** 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');
}
?>[/code]

Anyone have any ideas how i can do this
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.