# \[PHP\]PHP mailer, instead of echoing a messege, go to a different page

**URL:** <https://forum.kirupa.com/t/php-php-mailer-instead-of-echoing-a-messege-go-to-a-different-page/180750>\
**Category:** Uncategorized\
**Created:** [March 3, 2006, 4:33am UTC](https://forum.kirupa.com/t/php-php-mailer-instead-of-echoing-a-messege-go-to-a-different-page/180750 "2006-03-03T04:33:17Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![evileks](https://avatars.discourse-cdn.com/v4/letter/e/cab0a1/32.png) [@evileks](https://forum.kirupa.com/u/evileks)\
**Post date:** [March 3, 2006, 4:33am UTC](https://forum.kirupa.com/t/php-php-mailer-instead-of-echoing-a-messege-go-to-a-different-page/180750/1 "2006-03-03T04:33:17Z")

</div>

Hey everyone!

I have a PHP mailer setup on my website and I have a question on how I can enhance it a little. The php mailer page can be found [here](http://www.razergames.com/contact.html).

It’s just a basic form with the action set to “mailer.php”. The php is made up of

```php
<?php 
if(isset($_POST['action'])) { 
$to = "(email editted out)"; 
$subject = "New Messege"; 
$name_field = $_POST['name']; 
$email_field = $_POST['email'];
$messege = $_POST['messege']; 
  
$body = "From: $name_field
 Email: $email_field
 Messege:
 $messege"; 
  
echo "Your messege has been sent, please press the back button to return home."; 
mail($to, $subject, $body); 
} else { 
echo "Error!"; 
} 
?> 

```

What I want to do is when someone submits the form sucessfully rather then echoing the messege “Your messege has been setn, please press the back buttom to return home.” I want it to take them to a different .html page.

Can anyone help me with how this should be rewritten to do what I had in mind?

All comments appreciated. Thanks in advance!
