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

How to receive name and student number in php

angryTom
Release: 2023-02-28 06:46:02
Original
4460 people have browsed it

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>
Copy after login

2. Then receive it through $_GET.

<?php
$student_code = $_GET["code"];
$student_name = $_GET["name"];
// 后续操作
Copy after login

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!

Related labels:
php
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template