验证成功完成后重定向到email.php页面

Here i'm trying to send a contact form values to email id. I've posted contact.php page code. I've done server side validation on same page. After validation successfully completed it should redirect to email.php page. How should i do?

Contact.php

 <?php
    $errname = "";
    $errmotorcycle = "";
    //some codes

    if($_POST["contacts"] == "all")
    {
        // name validation
        if(empty($_POST["name"]))
        {
            $errname = '<span class="error">Should not be empty</span>';
        }
        else if(preg_match("/^[a-zA-Z ]+$/", $_POST["name"]) === 0)
        {
            $errname = '<span class="error">Name must be from letters and spaces only</span>';
        }
        else
        {
            $errname = '';
        }
        // motorcycle validation
        if($_POST["typeofmotor"] == "empty")
        {
            $errmotorcycle = '<span class="error">You must select one option</span>';
        }
        //some codes
    }
 ?>

<html>
<head><title></title></head>
<body>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" >
<input type="hidden" name="contacts" value="all" />
<table width="980" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td width="281" height="40" class="rightalign">Name : </td>
    <td width="268"><input type="text" name="name" class="normal" value="<?php $_POST['name']; ?>" /></td>
    <td width="431" valign="middle"><?php if(isset($errname)) echo $errname; ?></td>
  </tr>
 //some codes
</table>
</form>
</body>
</html>

After sending the eMail, you could redirect the browser like that:

<?php
header('Location: http://www.example.com/email.php');
die();
?>

If you choose that solution, please keep in mind that headers may only be sent before any content is sent to the browser.

You can't redirect to another script and use the POST vars as well, because they will be lost after the redirect. You can include the email.php script:

<?php
include( dirname( __FILE__ ) . "/email.php");