mj_jeff Posted July 3, 2004 Posted July 3, 2004 Hi...I can't seem to get the following error to go away. I've been working on it for about a week, and just can't seem to get it. Happens when I input a invalid email..validation works, but then I get header error. The form was not submitted for the following reasons: your email address is invalid. Please use your browser's back button to return This form is powered by Jack's Formmail.php 4.2! Warning: Cannot modify header information - headers already sent by (output started at /web/xxxx/public_html/contact/scripts/webmaster.php:234) in /web/xxxx/public_html/contact/scripts/webmaster.php on line 374 and here's my code (private data edited out of course) $redirect = "http://www.xxx/contact/after_mail.htm"; // our mighty error function.. function print_error($reason,$type = 0) { global $version; build_body($title, $bgcolor, $text_color, $link_color, $vlink_color, $alink_color, $style_sheet); // for missing required data if ($type == "missing") { ?> <p> </p> <h2>The form was not submitted for the following reasons:</h2> <ul><?php print("$reason.\n"); ?></ul> <p>Please use your browser's back button to return to the form and try again.</p> <?php } else { // every other error ?> <h2>The form was not submitted because of the following reasons:</h2> <?php } print("<br><br>\n"); echo "<small>This form is powered by <a href=\"http://www.lumbroso.com/scripts/\">Jack's'>http://www.lumbroso.com/scripts/\">Jack's Formmail.php $version!</a></small>\n\n"; } function mail_it($content, $subject, $email, $recipient, $allowed_email_recipients_array) { $recipient = $new_recipient; mail($recipient, $subject, $content, "From: $email\r\nReply-To: $email\r\nX-Mailer: DT_formmail"); } if ($required) $require = $required; // handle the required fields if ($require) { // seperate at the commas $require = ereg_replace( " +", "", $require); $required = split(",",$require); for ($i=0;$i<count($required);$i++) { $string = trim($required[$i]); // check if they exsist if((!(${$string})) || (!(${$string}))) { // if the missing_fields_redirect option is on: redirect them if ($missing_fields_redirect) { header ("Location: $missing_fields_redirect"); exit; } $require; $missing_field_list .= "<b>Missing: $required[$i]</b><br>\n"; } } // send error to our mighty error function if ($missing_field_list) print_error($missing_field_list,"missing"); } $content = parse_form($HTTP_POST_VARS); // if the env_report option is on: get eviromental variables if ($env_report) { $env_report = ereg_replace( " +", "", $env_report); $env_reports = split(",",$env_report); $content .= "\n------ eviromental variables ------\n"; for ($i=0;$i<count($env_reports);$i++) { $string = trim($env_reports[$i]); if ($env_reports[$i] == "REMOTE_HOST") $content .= "REMOTE HOST: ". $REMOTE_HOST."\n"; else if ($env_reports[$i] == "REMOTE_USER") $content .= "REMOTE USER: ". $REMOTE_USER."\n"; else if ($env_reports[$i] == "REMOTE_ADDR") $content .= "REMOTE ADDR: ". $REMOTE_ADDR."\n"; else if ($env_reports[$i] == "HTTP_USER_AGENT") $content .= "BROWSER: ". $HTTP_USER_AGENT."\n"; } } mail_it(stripslashes($content), stripslashes($subject), $email, $recipient, $allowed_email_recipients_array); // if the redirect option is set: redirect them if ($redirect) { header ("Location: $redirect"); exit; } else { print "Thank you for your submission\n"; echo "<br><br>\n"; echo "<small>This form is powered by <a href=\"http://www.lumbroso.com/scripts/\">Jack's Formmail.php $version!</a></small>\n\n"; exit; any help hugely appreciated thanks a bunch jeff Quote
TCH-Andy Posted July 3, 2004 Posted July 3, 2004 Ji Jeff, Welcome to the family Warning: Cannot modify header information - headers already sent by (output started at /web/xxxx/public_html/contact/scripts/webmaster.php:234) in /web/xxxx/public_html/contact/scripts/webmaster.php on line 374This is usually because when you edited webmaster.php there are some blank lines at the bottom of the file after the cloing php statement. Delete any blank spaces, and it should cure that problem Quote
kaseytraeger Posted July 3, 2004 Posted July 3, 2004 I also notice that you're running Jack's FormMail 4.2. You may want to consider updating ... he has now released version 5.0. (http://www.dtheatre.com/scripts/) Just a suggestion... Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.