Click to See Complete Forum and Search --> : Undefined variable


livetek
07-28-2001, 12:16 AM
Hello

We are running PHP Version 4.0B2 on Linux server and facing the problem that variable not defined. But if we run the same code on
winNT and PHP Version 4.0.0 then we don't face such a problem that variable not defined.

It gives the problem
Warning: Undefined variable: userlogin in bottom.php on line 3

// The code is
<?php
if($userlogin=="Login")
{
print "Login";
}
?>

<body>
<form name="frm" action="PHP_SELF" method="post">
<input type="submit" name="userlogin" value="Login">
</form>
</body>

// End of code


If anybody can help that why this problem is coming, and is there any solution for that. and we don't want to loose the value of userlogin is it something related to the configuration of PHP or some other reason is there? If you know then please help us.

Thanks
Livetek

darren
08-30-2001, 02:17 PM
<?php
if($userlogin==\"Login\")
{
print \"Login\";
}
?>

to

<?php
if(!isset($userlogin))
{
print \"Login\";
}
?>