Html uses form tags to interact with users and form tags

Source: Internet
Author: User

Html uses form tags to interact with users and form tags
Use Form tags to interact with users

How does a website interact with users? The answer is to use an HTML form (form ). A form can transmit the data input by the viewer to the server, so that the server program can process the data transmitted from the form.


<Form method = "Transfer method" action = "Server File">


1.<Form>:<Form> tags appear in pairs, starting with <form> and ending with </form>.

2.Action :The place where the data input by the viewer is sent, such as a PHP page (save. php ).

3.Method :Data transmission method (get/post ).

<FormMethod = "post" action = "save. php"> <Label for = "username"> User name: </label> <input type = "text" name = "username"/> <label for = "pass"> password: </label> <input type = "password" name = "pass"/> </form>


1. All Form Controls (text box, text field, button, single button, check box, etc) must be placed between <form> </form> labels (otherwise, the information entered by the user cannot be submitted to the server !).

The get and post methods in Form correspond to the GET and POST methods respectively during data transmission.
The main differences between the two are as follows:

1. Get adds the data in the form to the URL pointed to by action in the form of variable = value, and the two use "?" And each variable is connected by "&". Post puts the data in the form data body and passes the data to the URL indicated by the action according to the corresponding variables and values.
The format is as follows:
Http:// Name = lilian & password = 12345678
2. Get is insecure because data is stored in the requested URL during transmission, so that some private information may be viewed by a third party.
3. The size of data transmitted in Get mode is very small, generally around 2 kb, but the execution efficiency is better than that of Post method. In Post mode, the amount of data transmitted is relatively large, it is waiting for the server to read data, but there are also byte restrictions. This is to avoid malicious attacks on the server using a large amount of data. According to Microsoft, Microsoft uses Request. the maximum data that Form () can receive is limited. IIS4 is 80 KB, and IIS5 is kb.

To sum up, use the Post method whenever possible.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.