PHP提交重定向[关闭]

I'm doing a form with a submit button, but the submit button just takes you to the same page, I would like it to redirect to a specific page. How would this be done?

<body><form action="login.php" method="POST" >
<table>
<tr>
<td>Username: </td><td><input type="text" name="username" /></td>
</tr>
<tr>
<td>Password: </td><td><input type="password" name="password" /></td>
</tr>

</table>
<input type="submit" value="Log In"/> &nbsp;  &nbsp; &nbsp; &nbsp;<input type="button"   value="Register" onClick="location.href='register.php'" />
<?php header('Location: WHATEVER.php'); ?>

http://php.net/manual/en/function.header.php

This has been downvoted twice and upvoted three times... So... Let's think here people. if you LOGIN you NEED to go to login.php to submit the data to PHP then have PHP send the to the desired page, NOT HTML or you NEVER login.

if($successful_login){
   header('Location: WHATEVER.php');
} else {
   // Then send them back to login.php because their login failed.

}

I tried your code on Google Chrome and I was redirected to login.php without any problems. If this is your entire code, then you are missing a closing </form> tag which could probably be a reason for improper behavior when using a different browser.

Also verify that login.php isn't sending the client back to the page you posted.

<form action="DESIRED_PAGE.PHP" method="POST" >

You have to target the action attribute of the form to the page you want it sends your form.