注册页面的制作
前端
<h1>注册页面</h1> <form action="./Untitled-zhucechuli.php" method="post"> <div>用户名<input type="text" name="uid" /></div> <div>密码<input type="password" name="pwd" /></div> <div>姓名<input type="text" name="name" /></div> <div><input type="submit" value="注册" /></div> </form>
后端
$uid = $_POST["uid"]; $pwd = $_POST["pwd"]; $name = $_POST["name"]; //造连接对象 $db = new MySQLi("localhost","root","456","asdadads");数据库名 //写SQL语句 $sql = "insert into mydb values('{$pwd}','{$uid}','{$name}')"; $db->query($sql);