My page has both sign up and sign in forms on it and the action attribute of both forms is set to the same address. <form action="verify.php" method="post" name="signup"> ... </form> <form action="verify.php" method="post" name="signin"> ... </form> HTML: Now in verify.php, how do I know whether the data received was submitted through the sign up form or through the sign in form?
You can either use a submit button name="submit" value="Signup" and name="submit" value="Login" to differentiate the two, or simply a hidden field.
<form action="verify.php?q=signup" method="post" name="signup"> ... </form> <form action="verify.php?q=login" method="post" name="signin"> ... </form> Use this php code: <?php if($_GET['q'] == 'signup') { //signup } elseif($_GET['q'] == 'login') { //Login } ?> PHP:
If you already got a form, there's no sense in adding in the query string to the action= itself, but rather <input type="hidden" name="q" value="..."/>