How to receive name and student number in php
1. First, submit the form:
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>Document</title> </head> <body> <h1>请输入:</h1> <form action="index.php" method="GET"> 请输入学号:<input type="text" name="code"/><br/> 请输入姓名:<input type="text" name="name"/><br/> <input type="submit" value="查询" /> </form> </body> </html>
2. Then receive it through $_GET.
<?php $student_code = $_GET["code"]; $student_name = $_GET["name"]; // 后续操作
Note: Whether PHP uses $_GET or $_POST needs to correspond to the form method attribute.
For more PHP related knowledge, please visit PHP Chinese website!
The above is the detailed content of How to receive name and student number in php. For more information, please follow other related articles on the PHP Chinese website!