Current location - Education and Training Encyclopedia - Graduation thesis - Use of HTML forms
Use of HTML forms
Forms wrap form elements, and the form elements wrapped by forms will be submitted to the server.

& lt form action= "address" method = "">

Shape elements

& lt/form & gt;

A form label is the shell of a form and has four main attributes:

Action: Form submission address (background server address)

Method: the method of submitting the form, two request methods, post and get.

Goal: Where to start?

Enctype: (encoding method)

Applocation/x-www-form-erlencoded encodes all characters before sending (default).

Text/plain: Spaces are converted into "+"symbols, but special characters are not encoded.

Multipart/form-data: This value must be used when using a form containing a file upload control. For example: uploading audio and video.

1, difference: (reflected in mode, security and data volume)

-mode, click Submit, and get will change the request data to "k=value" and then assemble it on the URL. When the request is submitted through post, the data is transmitted to the background through the browser, but the URL has not changed.

-security, get assembling information on URL, information leakage, insecurity; The URL of the post bar mode has not changed, which is safer.

-The amount of data, the number of characters that can be stored in the browser address bar is limited (limited capacity), and the URL in get mode is too long. When the limit is exceeded, the browser automatically truncates the URL, and the data transmitted to the background is incomplete, so the data size is limited. The URL in post mode is cleaner and lighter, which can completely transfer data to the background, and there is no data size limit.

2. when to use get and when to use post (usage scenario)

Get: query things from the background, such as querying papers; That is to ask for data from the background and get a lot of data with keywords. The safety requirement is low and simple.

Post: send data to the background, such as checking the duplication of papers (a large amount of data is submitted to the background). High security requirements.

Is an information collection element of a form, and has the following properties:

& lt="input_username "> label name: the label of. Password:

Effect:

Effect:

Effect:

& lt label & gt My car:

Effect:

& lt tags & gt comments:

Effect:

& lt label ="zjz "> certificate photo:

Where accept specifies the file format.

Effect:

& ltinput type = " hidden " name = " ABC " value = " 123 " >

Click Submit, and the hidden data will also be submitted to the background; abc=' 123 '

Function: (1) Store information temporarily (invisible to users) so that designers can call the program at any time.

(2) Used for security verification, for example, by setting a hidden domain, the server can verify the user's authority and avoid submitting data by a fake website.

& ltinput type = " button " value = " button "/& gt;

Effect:

& ltinput type = " submit " value = " submit "/& gt;

Effect:

& ltinput type = " reset " value = " reset "/& gt;

Effect: