Hi
I have done a page that auto emails my client when it loads but there is a secondary email action that emails the user his quote when he presses a 'send email' button (see line 44). But when the email sends the page just refreshes and I want it to redirect to a 'thank you' page.....when I try to add a redirect header it keeps sending error messages that the header is already sent from the top of the page.....but this script sits within some html as it gather information to email to the client....any ideas guys?
Look at the code attached and I need the redirect to work from the SECOND email action on line 39.
<?php
if(!isset($_SESSION['EmailSentToOwner']))
{
$str_email_buffer = '<html>
<head>
<title>Your Instant Quotation</title>
<link rel="stylesheet" type="text/css" href="http://myserver.com/_stylesheets/txt.css">
</head>
<body><center><div style="padding-bottom:15px;" align="center" style="width:600px;text-align:center;border:1px solid #330066;"><table width="600px" cellpadding="0" cellspacing="0" border="0"><tr><td background="http://quote.jahughes.com/fees/images/header.png" style="width:600px; height:99px;background-image:url(\'http://quote.jahughes.com/fees/images/header.png\');" align="center" valign="middle"><img src="http://quote.jahughes.com/fees/images/logo.gif"></td></tr></table><p style="margin:15px 0;">Below is the quote details for '.$_SESSION['txtName'].', email address '.$_SESSION['txtEmailAddress'].'</p>';
}
if(isset($_GET['Email']))
{
$str_email_buffer = '<html>
<head>
<title>Your Instant Quotation</title>
<link rel="stylesheet" type="text/css" href="http://myserver.com/_stylesheets/txt.css">
</head>
<body><center><div style="padding-bottom:15px;" align="center" style="width:600px;text-align:center;border:1px solid #330066;"><table width="600px" cellpadding="0" cellspacing="0" border="0"><tr><td background="http://quote.jahughes.com/fees/images/header.png" style="width:600px; height:99px;background-image:url(\'http://quote.jahughes.com/fees/images/header.png\');" align="center" valign="middle"><img src="http://quote.jahughes.com/fees/images/logo.gif"></td></tr></table><p style="margin:15px 0;">Dear '.$_SESSION['txtName'].', email address '.$_SESSION['txtEmailAddress'].'</p>';
}
$str_email_buffer .= ob_get_flush() . '</div></center></body></html>';
// Set the from header type and we want to send an html email
$str_email_headers = "From: admin@myserver.com <admin@myserver.com>\n";
$str_email_headers .= "MIME-Version: 1.0\n";
$str_email_headers .= "Content-Type: text/html; charset=iso-8859-1\n";
if(!isset($_SESSION['EmailSentToOwner']))
{
$_SESSION['EmailSentToOwner'] = TRUE;
mail('temp@myserver.com', 'New Quotation', $str_email_buffer, $str_email_headers);
}
if(isset($_GET['Email']))
{
mail($_SESSION['txtEmailAddress'], 'Your Quotation', $str_email_buffer, $str_email_headers);
}
?>
</a></p>
<a href="JAHughes_terms.pdf"><img border="0" alt="Terms & Conditions" src="_images/Terms.gif"></a></p>
<p style="margin:10px 0;"><a href="_DisplayQuote.html?Email=True"><img border="0" alt="Email Quote" src="_images/Email_Quote.gif"></a></p>
<p style="margin:10px 0;"><a href="#" onClick="window.print();return false"><img border="0" alt="Print Your Quote" src="_images/pRINT_Quote.gif"></a></p>
<p style="margin:10px 0;"><a href="index.html"><img border="0" alt="Get A New Quote" src="_images/New_Quote.gif">
</a></p>