The difference between HTML form form submission method get and post

The method attribute specifies how to send the form's data. There are two methods of submission, get and post.

1. get: The amount of data submitted should be less than 1024 bytes. When the form is submitted, the value of the form field (information requested by the form: account number, password...) will be displayed in the address bar.

<!DOCTYPE html>
<html>
<head>
    <title>测试get提交数据方法</title>
</head>
<body>
    <center>
        <form action="https://www.baidu.com" method="get">
            <p>用户名:<input type="text" name="name"/></p>
            <p>密码:<input type="password" name="pwd"/></p>
            <input type="submit" value="登录">

        </form>
    </center>
</body>
</html>
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16

Log in to the main interface: 
write picture description here

Jump page: 
write picture description here

2. post: The amount of data transmitted is not limited. When the form is submitted, the field value of the form (information requested by the form: account number, password...) will not be displayed in the address bar, with high security performance, and the information is hidden, generally in the Post is used in development.

<!DOCTYPE html>
<html>
<head>
    <title>测试post提交数据方法</title>
</head>
<body>
    <center>
        <form action="https://www.baidu.com" method="post">
            <p>用户名:<input type="text" name="name"/></p>
            <p>密码:<input type="password" name="pwd"/></p>
            <input type="submit" value="登录">

        </form>
    </center>
</body>
</html>
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16

Log in to the main interface: 
write picture description here

Jump page: 
write picture description here


Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325559245&siteId=291194637