I'm working on a simple feedback submission form for my personal site. I am getting the following error
Warning: Cannot modify header information - headers already sent by (output started at /home/content/92/9339092/html/Pages/ArabicRootMachine/feedbackTEST.php:200) in /home/content/92/9339092/html/Pages/ArabicRootMachine/feedbackTEST.php on line 226*
I've tried adding ob_start() to buffer any output, but that didn't work. If I put the header() call at the beginning of the php script, the form works and sends the e-mail, but it doesn't redirect to the thank you page. Any of you superior mammals willing to breeze through to see if there is anything obvious that might throw this error?
Note: Line 200 is the beginning of the script (the php open tag), line 226 is the header call.
<?php
include('./includes/title.inc.php');
require_once('./includes/recaptchalib.php');
$public_key = '****************************************';
$private_key = '****************************************';
$errors = array();
$missing = array();
// check if the form has been submitted
if (isset($_POST['send'])) {
// email processing script
$to = 'blahblah@gmail.com';
$subject = 'Feedback on Root Machine';
// list expected fields
$expected = array('name', 'email', 'comments');
// set required fields
$required = array('name', 'email', 'comments');
// create additional headers
$headers = "From: My Next Bit<feedback@mynextbit.com>\r\n";
$headers .= 'Content-Type: text/plain; charset=utf-8';
$response = recaptcha_check_answer($private_key, $_SERVER['REMOTE_ADDR'], $_POST['recaptcha_challenge_field'], $_POST['recaptcha_response_field']);
if (!$response->is_valid) {
$errors['recaptcha'] = true;
}
require('./includes/processmail.inc.php');
if ($mailSent) {
header('Location: http://www.mynextbit.com/Pages/ArabicRootMachine/thank_you.php');
exit();
}
}
?>
Please let me know if you need to see either of the **.inc.php files. I very much appreciate any help.