PHP script not running after form POST<

liunx

Guest
What am I doing wrong? I have a simple form that accepts username and password information and sends it to a script called authent.php. Here are my forms:

<form method="POST" action="authent.php">
<input type="text" name="username">
<input type="password" name="password">
<input type="submit" value="Login">
</form>
<form method="POST" action="authent.php">
<input type=submit name=submit value="Gammonsj">
<input type=hidden name=username value="gammonsj">
<input type=hidden name=password value="password">
</form>

When I use the first and type in a username and password, the address that comes up is index.php?username=gammonsj&password=password&submit=Login
yet when I click the second form button, it takes me to authent.php and the script runs fine. Am I losing my mind or just overlooking something?First of all, I would check that this problem is not caused by having two forms on one page or something, though I doubt that is the problem.

You said you got that stuff in your address. You shouldn't get any of that if you're using post. that might have something to do with the problem.

maybe a $_POST['username'] will help, if you're using $username in the script?Well, I don't know what the hell was going on but I moved it to a different section of the page and it worked fine. Didn't even retype it, just cut and pasted. Double checked all of my tag structure surrounding it and everything looks fine. Oh well, as long as people can login somewhere I guess.the submit button should always be last, after all your hidden form inputs.
the only way fo rthis form to post to the url

<form method="POST" action="authent.php">
<input type="text" name="username">
<input type="password" name="password">
<input type="submit" value="Login">
</form>

is if the form is open above it. if you use POST as the method there is no way it can go in the url. you must have another form on the page that uses GET
 
Back
Top