How to use GET and POST of PHP
This article mainly introduces "how to use GET and POST of PHP". In daily operation, I believe many people have doubts about how to use GET and POST of PHP. The editor consulted all kinds of materials and sorted out simple and easy-to-use methods of operation. I hope it will be helpful to answer the doubts about "how to use GET and POST of PHP". Next, please follow the editor to study!
1. Login page (GET)
1. Modify the action property to ".. / php/dl.php": submit the form content to this page for execution.
2. Modify the method attribute to "get": the submission method is GET.
Please enter your user name and password for login: password:
Run result: whatever the user name is submitted here, the following parameters will be accepted by dl.php.
3. Write dl.php
/ / specify the encoding method
Run result: whatever the user name is submitted here, the following parameters will be accepted by dl.php.
4. Only registered users can log in, so add a judgment about the database later.
First determine whether it is a form submission, and then determine whether the user name and password are empty and correct
The parameters submitted by http://192.168.1.129/php/dl.php?user=aiyou&pass=bucuo&submit= login are all in URL, which is not safe.
Registration page (POST)
1. Modify the action property to ".. / php/zc.php": submit the form content to this page for execution.
2. Modify the method attribute to "post": the submission method is POST.
User name: password: confirmation password: sex: love between men and women: singing, dancing, watching movie avatar upload: personality signature:
Run result: whatever the user name is submitted here, the following parameters will be accepted by zc.php.
3. Write zc.php
It only determines whether the user name, password and confirmation password are filled in, and does not involve the database.
At this point, the study on "how to use GET and POST of PHP" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!