One example: I created a form that collects user information including some expenditures (form.php). Upon submission, this information is posted for review and the expenditures are totaled (formReview.php). This all works fine. However I do not know how to pass the email address collected in form.php to the mail form, mailform.php.
In form.php I collect the email address with:
Code: Select all
<input type="text" name="toEmail">Code: Select all
<?php echo $_POST["toEmail"]; ?>Code: Select all
<?php
$to = ""; <- would like to insert "toEmail" from HTML input name value
$subject = "Reimbursement"; <- set value, standard subject line
$message = ""; <- would like to send entire formatted form (no idea how to capture this)
$from = ""; <- would like to insert "fromEmail" from HTML input name value
$headers = "From: $from";
mail($to,$subject,$message,$headers);
echo "Thank you, Mail Sent.";
?>Thanks,
Jack