I have been working on the script below for a number of hours. It is called form a HTML form. The email send works fine, but when I attempt to load a Thank you page, I get the following error: Warning: Cannot modify header information - headers already sent by (output started at /home/content/l/a/r/larryrmoses/html/Alumni/contact.php:1) in /home/content/l/a/r/larryrmoses/html/Alumni/contact.php on line 18
I have checked for whitespace in the file. I have added the ob_start and flush functions, but I still get the error. Any additional ideas or solutions would be appreciated.
PHP Code:
<?php ob_start();
$subject = "Alumni Information";
$fields = array();
$fields{"FirstName"} = "First Name";
$fields{"LastName"} = "Last Name";
$fields{"Email"} = "Email";
$fields{"Phone"} = "Phone";
$fields{"MailingAddress"} = "Address";
$fields{"City"} = "City";
$fields{"State"} = "State";
$fields{"ZipCode"} = "Zip Code";
$fields{"Information"} = "Information";
$body = "We have received the following information:\n\n";
foreach($fields as $a => $b){
$body .= sprintf("%20s: %s\n",$b,$_REQUEST[$a]);}
$send = mail("
info@desertvalleyacademy.org", $subject, $body, "Web Site");
if($send){
header("Location:
http://www.desertvalleyacademy.org/Alumni/Thanks.html");}
ob_end_flush(); ?>