HTML uses form tags to interact with users

Source: Internet
Author: User
Tags html form

Use form labels to interact with users

How does a website interact with users? The answer is to use an HTML form (form). The form can transfer the data entered by the browser to the server side, so that the server-side program can process the data that the table only son over.

Grammar:

<form method= "transfer Mode" action= "Server File" >

Explain:

1.<form>:<form> tag is in pairs, to <form> start, to </form> end.

2.Action : where the data entered by the browser is transmitted, such as a PHP page (save.php).

3.method : The way data is transmitted (Get/post).

<form method= "POST" action= "save.php" > <label for= "username" > user name:</label> <input t Ype= "text" name= "username"/> <label for= "pass" > Password:</label> <input type= "password" name= "p The/></form>

Attention:

1. All form controls (text boxes, text fields, buttons, radio boxes, checkboxes, and so on) must be placed between the <form></form> tags (otherwise the user input information can not be submitted to the server Oh!). )。

The Get and post methods in the form, respectively, correspond to the Get and post methods during data transfer.
The main differences are as follows:

1. Get adds the data in the form in the form of Variable=value, followed by the URL to which the action points, and both use "?". connections, and each variable is connected by a "&" connection; Post is the data in the form that is placed in the data body of the forms, in the same way that the variables and values are passed to the URL that the action points to.
The following form:
Http://www.280.cc/index.php/playlist/index

2, get is not safe, because in the transmission process, the data is stored in the requested URL address, so that there may be some privacy information to be seen by third parties.
3, get mode of transmission of data is very small, generally limited to about 2KB, but the execution efficiency is better than the Post method, and the post way to pass a relatively large amount of data, it is waiting for the server to read the data, but also has a byte limit, this is to avoid the server with a large amount of data for malicious attacks, According to Microsoft, Microsoft has a limit on the maximum data that can be received with Request.Form (), 80KB bytes in IIS4, and 100KB bytes in IIS5.

In summary, please try to use the Post method.

HTML uses form tags to interact with users

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: info-contact@alibabacloud.com 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.