报名表单


报名表单



















.container {
max-width: 600px;
margin: 0 auto;
padding: 20px;
}

h1 {
text-align: center;
}

form {
display: flex;
flex-direction: column;
}

label {
margin-top: 10px;
}

input[type=”text”],
input[type=”email”],
input[type=”tel”],
input[type=”number”] {
padding: 5px;
border: 1px solid #ccc;
border-radius: 5px;
}

input[type=”radio”] {
margin-right: 10px;
}

input[type=”submit”] {
margin-top: 20px;
padding: 10px;
background-color: #007bff;
color: #fff;
border: none;
border-radius: 5px;
cursor: pointer;
}

input[type=”submit”]:hover {
background-color: #0062cc;
}
connect_error) {
die(“连接失败: ” . \(conn->connect_error);
}

// 获取表单数据
\)name = \(_POST[“name”];
\)email = \(_POST[“email”];
\)phone = \(_POST[“phone”];
\)gender = \(_POST[“gender”];
\)age = \(_POST[“age”];
\)address = \(_POST[“address”];

// 插入数据到数据库
\)sql = “INSERT INTO signup (name, email, phone, gender, age, address)
VALUES (‘\(name’, ‘\)email’, ‘\(phone’, ‘\)gender’, ‘\(age’, ‘\)address’)”;

if (\(conn->query(\)sql) === TRUE) {
echo “报名成功”;
} else {
echo “Error: ” . \(sql . “
” . \)conn->error;
}

\(conn->close();
?>
报名人员信息查询页面(PHP)
connect_error) {
die(“连接失败: ” . \)conn->connect_error);
}

// 查询数据
\(sql = “SELECT * FROM signup”;
\)result = \(conn->query(\)sql);

if (\(result->num_rows > 0) {
// 输出数据
while(\)row = \(result->fetch_assoc()) {
echo “姓名: ” . \)row[“name”]. ” – 邮箱: ” . $row[“email”]. ” – 电话: