GET method and POST method
##GET submission method (Rarely used)
<!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>用户注册</title> </head> <body> <font size="5" color="red">欢迎注册php.cn</font> <form name="user" method="get" action="" > 用户名:<input type="text" name="username"/> <br/> 密码:<input type="password" name="userpwd"/> <br/> <input type="submit" value="提交信息"/> </form> </body> </html>When testing locally, fill in the information and click submit, you can observe that the browser address bar changes to Description of the above URL:
Note: If a form element does not want to pass data to the server, then we can not add the name attribute to it. If the data passed to the server does not have a name, its value cannot be obtained.
Characteristics of the GET method:
##POST form submission method
POST submission method, it does not append the form data to the address, but directly passes it to the form handler.
Features of the POST method:
<!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>用户注册</title> </head> <body> <font size="5" color="red">欢迎注册php.cn</font> <form name="user" method="post" action="login.php" > 用户名:<input type="text" name="username"/> <br/> 密码:<input type="password" name="userpwd"/> <br/> <input type="submit" value="提交信息"/> </form> </body> </html>Note: During local testing, observe the changes in the address bar to see if it is the same as the get submission method