第一部分
<html>
<head>
<meta charset="utf-8" />
</head>
<body>
<form class="form-signin" action="do.php?action=register" method="post">
<h2 align='center'>学生信息注册</h2>
<label>账号:</label>
<input type="text" id="user">
<br><br>
<label>密码:</label>
<input type="password" id="pwd1">
<br><br>
性别:<input type="radio" name="sex" value="boy" /> 男
<input type="radio" name="sex" value="girl" checked="checked" /> 女
<br><br>
<label>年龄: </label>
<input type="age" id="age">
<br><br>
<input type="submit" value="注册信息" />
</body>
</html>
```第二部分的
<?php
/**
* 配置数据库信息
*/
define('host', '127.0.0.1'); // 主机,默认为127.0.0.1或者localhost
define('user', 'root'); // 用户,默认为root
define('passwd', ''); // 数据库密码,默认为控
define('dbName', 'stu'); // 你建立的数据库,记得要修改为你自己的!
$handle = mysqli_connect(host, user, passwd, dbName);
if (!$handle) {
die('连接数据库失败!' . mysqli_connect_error());
}
$action = $_GET['action']; // 获取get过来的action行为参数
// 如果行为参数为register我们继续进行下面的操作
if ($action == 'register') {
$password = $_POST['pwd1'];
$sex = $_POST['sex'];
$age = $_POST['age'];
}