Hi,
I'm new to php. i created a sign-in and register page. I have two forms, one for new users registration and other for user login. It has two submit buttons. Each calls different page when clicked.
The registration form is working well. But when I click the submit button for login, it is not working.
Thanks
senthil
Two forms, two submit buttons, different actions
Moderator: General Moderators
-
fractalvibes
- Forum Contributor
- Posts: 335
- Joined: Thu Sep 26, 2002 6:14 pm
- Location: Waco, Texas
the code
Hi,
Here is the code that i wrote.
Thanks
Senthil
<html>
<head>
<title>Sign-In</title>
</head>
<table>
<tr>
<td rowspan=7 width="15%">
</td>
<td width="40%" colspan=2>
<form name="form1" method="post" action="test_register.php">
<table>
<tr>
<td colspan=2 align="center">
Need a username and password?
</td>
</tr>
<tr>
<td>Username</td>
<td><input type="text" name="rname"></td>
</tr>
<tr>
<td>Password</td>
<td><input type="password" name="rpass1"></td>
</tr>
<tr>
<td>Confirm Password</td>
<td><input type="password" name="rpass2"></td>
</tr>
<tr>
<td>Email Address</td>
<td><input type="text" name="email"></td>
</tr>
<tr height=20></tr>
<tr>
<td colspan=2 align="center">
<input type="submit" name="register" value="Register">
</td>
</tr>
</table>
</form>
</td>
<td rowspan=7 width="15%">
</td>
<td width="40%" colspan=2>
<form name="form2" method="post" action="test_login.php">
<table>
<tr>
<td colspan=2 align="center">
Login
</td>
</tr>
<tr>
<td>Username</td>
<td><input type="text" name="lname"></td>
</tr>
<tr>
<td>Password</td>
<td><input type="password" name="lpass"></td>
</tr>
<tr height=20></tr>
<tr>
<td align="right">
<input type="submit" name="login" value="Login">
</td>
<td align="left">
<input type="reset" name="reset" value="Reset">
</td>
</tr>
</table>
</form>
</td>
</tr>
</table>
</body>
</html>
Here is the code that i wrote.
Thanks
Senthil
<html>
<head>
<title>Sign-In</title>
</head>
<table>
<tr>
<td rowspan=7 width="15%">
</td>
<td width="40%" colspan=2>
<form name="form1" method="post" action="test_register.php">
<table>
<tr>
<td colspan=2 align="center">
Need a username and password?
</td>
</tr>
<tr>
<td>Username</td>
<td><input type="text" name="rname"></td>
</tr>
<tr>
<td>Password</td>
<td><input type="password" name="rpass1"></td>
</tr>
<tr>
<td>Confirm Password</td>
<td><input type="password" name="rpass2"></td>
</tr>
<tr>
<td>Email Address</td>
<td><input type="text" name="email"></td>
</tr>
<tr height=20></tr>
<tr>
<td colspan=2 align="center">
<input type="submit" name="register" value="Register">
</td>
</tr>
</table>
</form>
</td>
<td rowspan=7 width="15%">
</td>
<td width="40%" colspan=2>
<form name="form2" method="post" action="test_login.php">
<table>
<tr>
<td colspan=2 align="center">
Login
</td>
</tr>
<tr>
<td>Username</td>
<td><input type="text" name="lname"></td>
</tr>
<tr>
<td>Password</td>
<td><input type="password" name="lpass"></td>
</tr>
<tr height=20></tr>
<tr>
<td align="right">
<input type="submit" name="login" value="Login">
</td>
<td align="left">
<input type="reset" name="reset" value="Reset">
</td>
</tr>
</table>
</form>
</td>
</tr>
</table>
</body>
</html>
I took the liberty of reformating your code. Works perfectly on my system. Maybe it was the missing <body>-tag, maybe the error is located at your system....
Code: Select all
<html>
<head><title>Sign-In</title></head>
<body>
<table>
<tr>
<td rowspan="7" width="15%"> </td>
<td width="40%" colspan=2>
<form name="form1" method="post" action="test_register.php">
<table>
<tr>
<td colspan="2" align="center">Need a username and password?</td>
</tr>
<tr>
<td>Username</td>
<td><input type="text" name="rname"></td>
</tr>
<tr>
<td>Password</td>
<td><input type="password" name="rpass1"></td>
</tr>
<tr>
<td>Confirm Password</td>
<td><input type="password" name="rpass2"></td>
</tr>
<tr>
<td>Email Address</td>
<td><input type="text" name="email"></td>
</tr>
<tr height="20"><td> </td></tr>
<tr>
<td colspan="2" align="center"><input type="submit" name="register" value="Register"></td>
</tr>
</table>
</form>
</td>
<td rowspan="7" width="15%"> </td>
<td width="40%" colspan="2">
<form name="form2" method="post" action="test_login.php">
<table>
<tr>
<td colspan="2" align="center">Login</td>
</tr>
<tr>
<td>Username</td>
<td><input type="text" name="lname"></td>
</tr>
<tr>
<td>Password</td>
<td><input type="password" name="lpass"></td>
</tr>
<tr height="20"><td> </td></tr>
<tr>
<td align="right"><input type="submit" name="login" value="Login"></td>
<td align="left"><input type="reset" name="reset" value="Reset"></td>
</tr>
</table>
</form>
</td>
</tr>
</table>
</body></html>