I've been trying to create a simple login script, but for some reason the header() function has not been working. For example, consider the below code:
<form method="POST">
<input type="submit">
</form>
<?php
if($_POST)
{
header("Location: www.example.com");
die();
}
?>
For some reason, this does not work (when a POST type submit button is clicked).
Having googled this issue, I've come to find that you cannot use the header() function with POST - you must use GET. However, using GET causes a query string to be shown in the URL, and this is not desirable when submitting login data.
What is the solution to this issue?