Well, if $submit_happening is set to 0, "0" or false then if($submit_happening) will evaluate to false while if(isset($submit_happening)) will evaluate to true
As the documentation (please read http://www.php.net/isset) isset() returns true if the variable exists and false if it doesn't. -Rasmus On Sat, 23 Feb 2002, jtjohnston wrote: > What's the difference between > if (isset($submit_happening)) > and > if $submit_happening) > > John > > [EMAIL PROTECTED] wrote: > > > On Fri, 22 Feb 2002 21:38:16 -0500, you wrote: > > > > >I'd to know how difficult it is to achieve the following: > > > > > >Create login page, when the submit button is clicked, the user info is checked >against a database as > > >to whether is login info is valid. if it is valid, a page is displayed that lists >all of the classes > > >that the user has registered for, meaning each user will see a different list of >classes. > > > > At first, I thought this was a homework question, but that seems > > unlikely. Ok, one way to do this is to have a form submit to itself. > > > > Briefly : > > > > <? > > if (isset($submit_happening)) { > > if ($username == "david" && $password="xyzzy") { > > echo("Successfully logged in"); > > } else { > > echo("Not logged in"); > > } > > } else { > > ?> > > <form method="post" action="<?=$PHP_SELF?>"> > > <input type="hidden" name="submit_happening" value="1"> > > <input type="text" name="username"> > > <input type="password name="password"> > > </form> > > <? > > } > > ?> > > > > Untested. If you want to store a user's logon status permanently, look > > at sessions. http://www.php.net/manual/en/ref.session.php > > > > djo > > -- > John Taylor-Johnston > ----------------------------------------------------------------------------- > ' ' ' Collège de Sherbrooke: > ô¿ô http://www.collegesherbrooke.qc.ca/languesmodernes/ > - Université de Sherbrooke: > http://compcanlit.ca/ > 819-569-2064 > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php