I am trying to send data to a page via a post header. This is for a login script I am doing, I basically don't want the users to see error=1
This is what I have so far, but all attempts seem not to send the post data.
$req="error=1";
header("method: POST");
header("Host: localhost");
header("Content-Type: application/x-www-form-urlencoded");
header("Content-Length: ".strlen($req));
header($req);
//header("Connection: close");
header('Location: index2.php');

Hi Russell, That's not any
Hi Russell,
That's not any kind of PHP post / submit construct that I'm familiar with - the location: header will override any previous statements, and simply redirect the users's web browser using HTTP code 302 (Moved Temporarily) to the new URL - but that is assuming that it is allowed to set headers - as you say your users are seeing the code that might imply missing PHP tags...
Perhaps if you could describe the process that you are trying to implement that would help. In general, a login script would receive credentials from a user; check those credentials against a user database; and if correct issue an authentication token as a cookie (using setcookie) which is then picked up by all other scripts and re-authenticated at every page view.
Typically, you would make that authentication token dependant upon the user's IP address; so that a cookie cannot be captured and then used to impersonate that user from another IP address....
Hope this helps,
Cheers,
David.