Master the correct way to use POST in PHP

autoload
Release: 2023-04-09 22:08:01
Original
4073 people have browsed it

Master the correct way to use POST in PHP

PHP frequently uses information transmission, which is why PHP came into being to realize dynamic web pages. For those with very little information , we may use GET, but when the data content is large, we will use POST. This article will take you to take a look.

First we write an html page:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <form action="test.php" method="POST"> 
           <label for="username">账号:</label>
           <input type="text" id="username" name="username">
           <label for="password">密码:</label>
           <input type="text" id="password" name="password">
           <input type="submit" value="提交">
    </form>
</body>
</html>
Copy after login

Master the correct way to use POST in PHP

php verification page: test.php

<?php

$name=$_POST[&#39;username&#39;];
$pass=$_POST[&#39;password&#39;];
echo "用户名:".$name."<br>";
echo "密码:".$pass."<br>";

?>
Copy after login
输出:用户名:lilil
      密码:4561212
Copy after login

Recommendation:2021 PHP interview questions summary (collection)》《php video tutorial

The above is the detailed content of Master the correct way to use POST in PHP. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
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