Home >Backend Development >PHP Problem >How to receive name and student number in php

How to receive name and student number in php

angryTom
angryTomOriginal
2019-10-30 10:41:324461browse

How to receive name and student number in php

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn