Mailer PHP... putting html into php?

This is my code:

<?php if(isset($_POST['button'])){//This page is only run when submitted// $to="[email protected]"; //specifying where it will send to// $subject="Form"; // first two stay constant specifying who to send and subject of email// $name_field = $_POST['name']; //take values from form// $email_field = $_POST['email']; //take values from form// $message = $_POST['message']; //take values from form// foreach($_POST['check'] as $value) { $check_msg .="Checked: $value/n"; // for each checkbox which is ticked it will be given a value } // check which values they have given $body = "From: $name_field\n E-Mail: $email_field\n Message:\n $message\n $check_msg "; //puts the values into the body text of the email the n means the value will show in the e-mail before showwing the inputted info, e-mail and message are varied and can change hence the n // echo" Data has been submitted to $to" ; // echo prints the message // mail($to, $subject, $body); // actually e-mails the message specifying to, subject and body as specified earlier// } else { echo "You didn't press the submit button... get out of here!"; //shows message if get to page through not pressing submit, echo prints anything in the speech marks directly to the screen// } ?>

Everything works fine but I was just wondering how do I make it so the user is taken to my html page when they have submitted their form?

At the moment it just shows Data has been submitted to [email protected]

I would like it to go to my page to say that…

I’ve just finished for the summer which is why it has lots of my class notes on it :stuck_out_tongue:

Any help would be brilliant!

As I understand it, you want to redirect users to another HTML page when they’ve successfully sent the email. You can use Header redirect to do this:

[php]Header(‘Location: thankyou.html’);[/php]

Sponsor our Newsletter | Privacy Policy | Terms of Service