Page 1 of 1

Undefined variable??

Posted: Sun Dec 29, 2002 1:21 pm
by Czar
I get following error "Undefined variable:user" with small user auth code. Don't get it...

Example:
Welcome to login area, please login with your username and pasword.<p></center>
<form method=post action = <?php echo $_SERVER['PHP_SELF']; ?>
<div align="center"><b>Username</b>:
<input type="text" size=15 name="user">
<b>Pass</b>:
<input type="password" size="15" name="pass">
<input type="SUBMIT" name="send" value="Enter">
</div>
</FORM>
<p>
<?php
if ($user == "user" && $pass == "pass")
{
etc...

Posted: Sun Dec 29, 2002 3:10 pm
by riley
You can check if the variable is set before the form information and set it to some default value.

Code: Select all

If (!IsSet($user))$user = "";