Two forms, two submit buttons, different actions

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
senthil
Forum Newbie
Posts: 12
Joined: Wed Jan 15, 2003 6:42 pm

Two forms, two submit buttons, different actions

Post by senthil »

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
fractalvibes
Forum Contributor
Posts: 335
Joined: Thu Sep 26, 2002 6:14 pm
Location: Waco, Texas

Post by fractalvibes »

If you could show some code, answers might be forthcoming from the forum, otherwise we don't know what you are doing in the code!

Phil J.
senthil
Forum Newbie
Posts: 12
Joined: Wed Jan 15, 2003 6:42 pm

the code

Post by senthil »

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>
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

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%">&nbsp;</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>&nbsp;</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%">&nbsp;</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>&nbsp;</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>
Post Reply