Problem retrieving form elements value on php
| From: | Krushna Kumar | Date: | Mon, 02 Dec 2002 06:17:55 +0000 |
| Subject: | Problem retrieving form elements value on php | ||
| Groups: | php.windows | ||
| Request: | Send a blank email to php-windows+get-17235@lists.php.net to get a copy of this message | ||
Dear All,
I have a HTML form and take user name and password, on submitting I try to validate the value on the
next file, but the input form element values are not retrieved on the following file, I have
provided the code I have written, Kindly help me trace the error.
Php version used - 4.2.3 and o/s windows NT4.0
Step 1
I have a HTML form with the following code
file - adminlogin.php
========================================================================================
<form name="frmadminlogin" method="post"
action="admin.php">
<table width="70%" border="0" cellspacing="0"
cellpadding="0" align="center">
<tr>
<td bgcolor="#fde9ac">
<div align="center"><font color="#990000"
size="3"><b>ADMIN LOGIN</b></font></div>
</td>
</tr>
<tr>
<td>
<table width="100%" border="0" cellspacing="0"
cellpadding="0">
<tr bgcolor="#FFFFD7">
<td width="10"> </td>
<td> </td>
<td> </td>
</tr>
<tr bgcolor="#FFFFD7">
<td width="10"> </td>
<td><font color="#000000">LOGIN</font></td>
<td><font color="#000000">
<input type="text" name="txtuser">
</font></td>
</tr>
<tr bgcolor="#FFFFD7">
<td> </td>
<td><font color="#000000">PASSWORD</font></td>
<td><font color="#000000">
<input type="password" name="txtpassword">
</font></td>
</tr>
<tr bgcolor="#FFFFD7">
<td colspan="3"> </td>
</tr>
<tr bgcolor="#FFFFD7">
<td colspan="3">
<div align="center"><font
color="#000000"></font><font color="#000000">
<input type="submit" name="submit"
value="Login">
<input type="reset" name="Reset"
value="Reset">
</font></div>
</td>
</tr>
</table>
</td>
</tr>
</table>
</form>
======================================================================================================
step 2 : I am trying to retrieve the values from the form in php using the code and check whether
username and password are correct
file name - admin.php
======================================================================================================
if (($txtuser=='user') && ($txtpassword=='password'))
{
//echo '<br>login success';
}
else
{
//echo 'login failure';
header('adminlogin.php?login=F');
}
======================================================================================================
Error : I get the following error when I submit the step 1 form and while trying to retrieve the
form element(input) value on the second form for validation. kindly help
======================================================================================================
Notice: Undefined variable: txtuser in E:\projects\jkfiles\admin.php on line 2
======================================================================================================
Regards
Krushna