Posted by deko on 06/13/06 01:22
This seems to be working...
This goes at the top of the page, before any other header info is sent:
$message = $_POST['message'];
$email = $_POST['email_address'];
if (!empty($message) && !empty($email))
{
header("Location:http://www.mysite.com/send-confirm.php");
mail("me @ mysite.com", "Feedback Form", $message, "From: $email");
exit;
}
This form can go anywhere in the page:
<form action="" method="post" name="feedback">
<input name="email_address" type="text" size="30" maxlength="255" /><br />
<textarea name="message" rows="12" cols="22" maxlength="4096"></textarea>
<input type="submit" value="Send">
</form>
Note that the form action is: ""
I have not tested this fully yet - it works writing the message to a file (as in
my previous example), but I don't know if it will send the message as an email.
The goal of this exersize was simply to redirect the user to a confirmation page
after successfully sending a message via an in-page feedback form on my web
site.
[Back to original message]
|