
January 25th, 2013, 01:17 PM
|
|
Registered User
|
|
Join Date: Jan 2013
Posts: 2
Time spent in forums: 19 m 10 sec
Reputation Power: 0
|
|
|
PHP coding Help
Hi
I have a form working on a site but want to add a captcha. I have added the code but I get the following error on Submission Quote: Message has been sent
Warning: Cannot modify header information - headers already sent by (output started at booking2.php:92) in /booking2.php on line 93 | Full Address Removed.
The form used to send the visitor to a "thank you" page but since adding the new script this doesn't happen. I am receiving the form but I can not get it to rediect to the thank you page.
Any help gratefully received.
I have included the php script without exact urls for security
PHP Code:
<? include_once $_SERVER['DOCUMENT_ROOT'] . '/contact/securimage/securimage.php'; $securimage = new Securimage(); if ($securimage->check(strtolower($_POST['passcode'])) == false) { print "<h2>Incorrect verification code</h2>Please hit 'back' and try again -" . $_POST['passcode']; exit; } else { foreach($_POST as $key => $val){ $val = str_replace("'", "", $val); $val = str_replace("\\", "", $val); $val = str_replace("`", "", $val); $val = str_replace("<", "", $val); $val = str_replace(">", "", $val); $val = str_replace("`", "", $val); $val = str_replace("!", "", $val); $val = str_replace("|", "", $val); $val = str_replace("MIME", "", $val); $_POST[$key] = $val; } require("class.phpmailer.php"); $mail = new PHPMailer(); //Your SMTP servers details $mail->IsSMTP(); // set mailer to use SMTP $mail->Host = "mail.xxxxx."; // specify main and backup server or localhost $mail->SMTPAuth = true; // turn on SMTP authentication $mail->Username = "XXXXX"; // SMTP username $mail->Password = "XXXXXX"; // SMTP password //It should be same as that of the SMTP user $redirect_url = "(XXXXXXX)"; //Redirect XXXafter submit the form $mail->From = $mail->username; //Default From email same as smtp user $mail->FromName = $_POST['email']; $mail->From = $mail->username; //Default From email same as smtp user $mail->FromName = $_POST['email']; $mail->AddAddress("andyhill@.com"); $mail->addCC("maggie@."); $mail->addBCC("maggie@."); //Email address where you wish to receive/collect those emails. $mail->WordWrap = 50; // set word wrap to 50 characters $mail->IsHTML(true); // set email format to HTML $mail->Subject = $_POST['subject']; $message = "Email Address :".$_POST['email']." <br> Name :".$_POST['fullname']." <br> Address:".$_POST['address']." <br> Daytime Telephone :".$_POST['daytime']." <br> Evening Telephone :".$_POST['evening']." <br> Arrival Date :".$_POST['arrival']." <br> Departure Date :".$_POST['departure']." <br> Number of Nights :".$_POST['nights']." <br> Guest 1 :".$_POST['guest1']." \r\n <br> Guest 2 :".$_POST['guest2']." \r\n <br> Guest 3 :".$_POST['guest3']." \r\n <br> Guest 4 :".$_POST['guest4']." \r\n <br> Guest 5 :".$_POST['guest5']." \r\n <br> Guest 6 :".$_POST['guest6']." \r\n <br> Guest 7 :".$_POST['guest7']." \r\n <br> Guest 8 :".$_POST['guest8']." \r\n <br> Guest 9 :".$_POST['guest9']." \r\n <br> Guest 10 :".$_POST['guest10']." \r\n <br> Weekly Rate :".$_POST['rate']." <br> Pool Heating :".$_POST['pool']." \r\n <br> Currency :".$_POST['currency']." Amount :".$_POST['amount']." <br> Party Leader :".$_POST['leader']." <br> Dated :".$_POST['date']; $mail->Body = $message; if(!$mail->Send()) { echo "Message could not be sent. <p>"; echo "Mailer Error: " . $mail->ErrorInfo; exit; } echo "Message has been sent"; header("Location: $redirect_url"); } ?>
Line 93 is
header("Location: $redirect_url");
}
I'm sure it must be something so silly but I can't work it out.
Cheers
Maggie
|