hi all. i have a very simple form on my website that calls a script called mailer.php.
here is mailer.php:
<?php
//set up mailer info
$sendTo = "me@mydomain.com";
$sendSubj = "demo form submission";
$xHeaders = "From: admin@mydomain.com\nX-Mailer: PHP/" . phpversion();
//lets get the data
$incoming_fields = array_keys($HTTP_POST_VARS);
$incoming_values = array_values($HTTP_POST_VARS);
//start the message
$message = "heres the form data...";
for ($i = 0; $i < count($incoming_fields); $i++) {
$message .= "$incoming_fields[$i]:\n$incoming_values[$i]\n\n";
}
//send the email
mail($sendTo, $sendSubj, $message, $xHeaders);
//redirect
header("Location: http://www.mydomain.com/index.php?action=thanks");
?>
but it errors out every time. i have seen intermittent errors about the header... can anyone help me?
if this is not the correct way to do it, please advise. here's what i need to do.
the form calls a script
script sends email
script redirects in same window.
thanks so much. i'm goin bonkers over here! oh - i forgot to mention that the mail actually sends ok. it just errors out in the browser.