Tutoriel de petit forum de développement PHP connexion-1
Créer un fichier login.html
Notre page de connexion utilise < table>Mise en page du tableau
Ajoutez quelques styles CSS simples, l'effet final est comme indiqué ci-dessous
Nous nous connecterons à la page fait un simple jugement JS Si le nom d'utilisateur et le mot de passe ne sont pas renseignés pour se connecter, des informations d'invite pertinentes seront fournies
Le code complet est le suivant
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>用戶登錄</title> </head> <body> <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>登陸界面</title> <script type="text/javascript"> function foo(){ if(myform.username.value=="") { alert("請輸入用戶名"); myform.username.focus(); return false; } if (myform.password.value=="") { alert("請輸入密碼"); myform.password.focus(); return false; } } </script> <style type="text/css"> table{ height: 300px; } input{ width: 190px; height: 25px; } .title{ background-color:#B10707 ; color: white; border: none; } .but{ width: 140px; height: 43px; } .spa{ margin-left: 10px; } </style> </head> <body> <form action="login.php" method="post" onsubmit="return foo();" name="myform" > <table width="400px" border="1" cellpadding="12" cellspacing="1" align="center"> <tr> <td colspan="2" class="title">會員登錄<span class="spa">[<a style="color: white" href="index.php">返回首頁]</a></span></td> </tr> <tr> <td width="110px">會員ID</td> <td><input type="text" name="username"></td> </tr> <tr> <td width="110px">會員密碼</td> <td><input type="password" name="password"></td> </tr> <tr> <td colspan="2" align="center"> <button class="but" style="text-align: center">立即登錄</button> </td> </tr> </table> </form> </body> </html>.
sera renseigné Les informations sont soumises à la page login.php pour traitement