|
Posted by Ian Rutgers on 05/17/06 07:41
Situation:
A user fills out a form and when submitted, the contents of the form (text
and variables) are sent in an email to a specified user. After the page has
been submitted a "Thank You" page is displayed. Each of the forms will have
fields with their unique form field names.
What I would like to do is pass the data to the Thank you page and have it
process the data and send the email.
Here is some of the code on the "form" page
<?
//email variable declaration
$message = ' '; //first we make sure the message string doesn't hold any
junk
$email_hunger = $_POST['hungry_heart'];
$email_liar_lunatic = $_POST['liar_lunatic_true'];
// now we build the message of the email
$message = "Hunger:" . $email_hunger ."\n" . "Liar Lunatic" .
$email_liar_lunatic;
session_start();
$_SESSION['message'] = $message;
?>
And then on the mail page I have ....
<?
//email variable declaration
$email_to = "person@abc.com";
$email_subj = "the form name";
$from_address = "bill@def.com";
// now we build the message of the email
session_start();
echo $_SESSION['message'];
$the_message = $_SESSION['message'];
// now we send the email
mail($email_to, $email_subj,$the_message,"From: $from_address"); //send
the message
?>
When I did things this way, Hunger and Liar Lunatic make to the body of the
message, but not the contents of $email_hunger and $email_liar_lunatic.
What I am doing wrong ... is there a better way???
Thank you
Signed ... a rookie from Canada!
Navigation:
[Reply to this message]
|