PHP user login form

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ibsaqi
    New Member
    • Oct 2011
    • 1

    #1

    PHP user login form

    Hello friends i am basically a new in programming language...i got readymade new login script and which i want to use for another form for my website.i.e


    Form that i want to use in my website is
    Code:
      
    <form action="process.php" method="post">
                
     <input type="text" id="username" name="username"  onfocus="this.value='';" onblur="if (this.value=='') {this.value='Username';}" value="user1" />  
                                        
                    
    <input type="password" id="password" name="password" onfocus="this.value='';" onblur="if (this.value=='') {this.value='************';}" value="pass" />
                  
    <input type="checkbox" value="c" name="rm" id="remember"/> <label for="remember">Remember me?</label>
                    
     <button id="login" value="" type="submit" name="login"></button>
                 ]
          </form>





    This is the readymade php script which i want to use for the above mention FORM.so what variables used to replace the in that FORM....really appreate your help


    PHP sCript


    Code:
     
    <?
    
    if($form->num_errors > 0){
       echo "<font size=\"2\" color=\"#ff0000\">".$form->num_errors." error(s) found</font>";
    }
    ?>
    <form action="process.php" method="POST">
    <table align="left" border="0" cellspacing="0" cellpadding="3">
    <tr><td>Username:</td><td><</td></tr>
    <tr><td>Password:</td><td><input type="password" name="pass" maxlength="30" value="<? echo $form->value("pass"); ?>"></td><td><? echo $form->error("pass"); ?></td></tr>
    <tr><td colspan="2" align="left"><input type="checkbox" name="remember" <? if($form->value("remember") != ""){ echo "checked"; } ?>>
    <font size="2">Remember me next time &nbsp;&nbsp;&nbsp;&nbsp;
    <input type="hidden" name="sublogin" value="1">
    <input type="submit" value="Login"></td></tr>
    <tr><td colspan="2" align="left"><br><font size="2">[<a href="forgotpass.php">Forgot Password?</a>]</font></td><td align="right"></td></tr>
    <tr><td colspan="2" align="left"><br>Not registered? <a href="register.php">Sign-Up!</a></td></tr>
    </table>
    </form>
    
    <?
    }
  • Dormilich
    Recognized Expert Expert
    • Aug 2008
    • 8694

    #2
    basically you can replace the form as is. you only need to make sure that the according form element names are retained (unless you want to change the PHP code (which you might have to do anyways))

    Comment

    Working...