Login Form
Posted: Mon Jul 19, 2010 10:25 am
Hi
Can somebody help with the mechanics/thought process behind a login form? I can do all the form creation and user checking but I'm struggling with performing the validation on the same page as the form and then moving to a new page once all is good - apologies should this not make sense but I'm struggling to explain it even to myself. The code below may help.
If I use the PHP_Self reference, how do I then move away from the form once everything is ok? Or if I set the from action to go to the page I want to ultimately go to how to I validate the information before going and stay if it's wrong?
Again sorry for the confusing content above but I'm not sure how best to explain.
Thanks
Chris
Can somebody help with the mechanics/thought process behind a login form? I can do all the form creation and user checking but I'm struggling with performing the validation on the same page as the form and then moving to a new page once all is good - apologies should this not make sense but I'm struggling to explain it even to myself. The code below may help.
Code: Select all
if(isset($_POST['submit']))
{
1.Connect and check the input against the records stored.
2.If everything is good, return to the page that called for the login
3. If it's not good return to the form
}
}
?>
<HTML>
<title><title>Login</title></HEAD>
<BODY>
<FORM method="post" action="<?php echo $PHP_SELF;?>">
<label for ="login" >Login</label>
<input type="text" name="login" style="font-size:10px;" value="your email address">
<label for ="password" >Password</label>
<input type="password" name="password" style="font-size:10px;">
<input type="submit" name="submit" value="Login">
</FORM>
Again sorry for the confusing content above but I'm not sure how best to explain.
Thanks
Chris