Thanks
When I submit a certain form (with 32 fields)to my PHP emailer scrip on the server, I just want to pass 2-4 of the submitted values on to the next page.
I have leaned how to do this in a very basic script I'm experimenting with. I modified one original line:
<?PHP
mail($to, $subject, $msg, $headers);
?>
to this, and it does work, but with static values:
<?PHP
mail($to, $subject, $msg, $headers);
if ($forward == 1) {
header ("Location:$location?customername=Andrea&lastmamage=43®ion=A&ordertotal=45.67");
?>
My hope is to replace an array in the script(that handles all fields of form) with indiviual variables, or somehow select certain values(fields), those being the few that will comprise the query string.
The complete test PHP script i'm using is:
<?PHP
$to = "email@domain.com"; #set address to send form to
$subject = "Results from your test PHP script "; #email subject line
$headers = "From: Your Site"; #set the from address, or any other headers
$forward = 1; # redirect once email is sent? 1 : yes || 0 : no
$location = "responsepage.htm"; #set page to redirect to, if 1 is above
Adds time and date to the email
$date = date ("l, F jS, Y");
$time = date ("h:i A");
the message part of the email
$msg = "Below is the result of your feedback form. It was submitted on $date at $time.\n\n";
if ($SERVER['REQUEST_METHOD'] == "POST") {
foreach ($POST as $key => $value) {
$msg .= ucfirst ($key) ." : ". $value . "\n";
}
}
else {
foreach ($_GET as $key => $value) {
$msg .= ucfirst ($key) ." : ". $value . "\n";
}
}
mail($to, $subject, $msg, $headers);
if ($forward == 1) {
header ("Location:$location?name=Andrea&email=email@domain.com&message=typedtext");
}
else {
echo "Thank you for submitting our form. We will get back to you as soon as possible.";
}
?>
The test form I'm using is:
<HTML>
<Body>
<form action="test.php" method="post">
Name: <input type="text" name="name"><br>
Email: <input type="text" name="email"><br>
Message: <textarea name="message"></textarea><br>
<input type="submit" name="submit" value="Submit Form">
</form>
</body>
</HTML>
I'm sorry I'm unsure of how to properly format my PHP and HTML code into the format boxes requested for postings. When I tried using the format, it deletes most of my code pasted to it. I'll work on it.
When I learn how how to accomplish this, I'll be using a better form mail script like DBmaster's Formm@ailer, with error and input value format checking.
Thanks for your time