到目前為止,你已經了解了足夠多的PHP了。該寫個小程序練手了。
用戶注冊系統
寫一個index.php頁面,有用戶名和密碼表單,post提交到check.php,輸出用戶名和"用戶名+密碼"的md5值
本地建立一個mysql數據庫,名叫segmentfault,建立一個表user,字段username password將上題check.php接收到的內容存入
我們先完成HTML部分:
- <!DOCTYPE HTML>
- <html>
- <head>
- <title>注冊</title>
- </head>
- <body>
- <h1>注冊</h1>
- <form action="check.php" enctype="application/x-www-form+xml" method="post">
- <p>
- <label for="name">郵箱</label>
- <input name="name" required type="email" placeholder="請填寫有效郵箱"></input>
- </p>
- <p>
- <label for="passphrase">密碼</label>
- <input name="passphrase" required type="passphrase"></input>
- </p>
- <p>
- <input type="submit" value="提交"></input>
- </form>
- </body>
- </html>
新聞熱點
疑難解答