Creating
A Thank You Page For Your Form Submissions.
Because your form action
is calling a separate page for processing
rather then using itself (we will cover
that later), you need to somehow let your
visitor know that information has been
sent.
To do this, you can pretty
much use any html page with text as you
normally would, and just place the php
code at the top of the page. So
for example, if you want to say
something like "Thank You, Your information
Has Been Submitted". You would
put your php at the top like this ...
<?PHP
$email = $_POST["emailaddress"];
$to = "you@youremail.com";
$subject = "New Email Address
for Mailing List";
$headers = "From: $email\n";
$message = "A visitor to your
site has sent the following email
address to be added to your mailing
list.\n
Email Address: $email";
$user = "$email";
$usersubject = "Thank You";
$userheaders = "From: you@youremailaddress.com\n";
$usermessage = "Thank you
for subscribing to our mailing list.";
mail($to,$subject,$message,$headers);
mail($user,$usersubject,$usermessage,$userheaders);
?> |
Then the html below would
look like this ...
<html>
<body>
<table width="400"
border="0" cellspacing="0"
cellpadding="0">
<tr>
<td>
<div align="center">Thank
You, Your Information Has Been Submitted</div>
</td>
</tr>
</table>
</body>
</html> |
So here is the full code
for the "process.php" page to
show the thank you message when they submit
their form. Keep in mind that the
page still has to have a .php extension
for your form to process correctly.
It will still read the html just fine.
<?PHP
$email = $_POST["emailaddress"];
$to = "you@youremail.com";
$subject = "New Email Address
for Mailing List";
$headers = "From: $email\n";
$message = "A visitor to your
site has sent the following email
address to be added to your mailing
list.\n
Email Address: $email";
$user = "$email";
$usersubject = "Thank You";
$userheaders = "From: you@youremailaddress.com\n";
$usermessage = "Thank you
for subscribing to our mailing list.";
mail($to,$subject,$message,$headers);
mail($user,$usersubject,$usermessage,$userheaders);
?>
<html>
<body>
<table width="400"
border="0" cellspacing="0"
cellpadding="0">
<tr>
<td>
<div align="center">Thank
You, Your Information Has Been Submitted</div>
</td>
</tr>
</table>
</body>
</html> |
Previous
- Next
|