Form Form Introduction and use rules

Form the front and back to achieve interaction: the user submits the form to the right and then back to submit to a background process database, realized before and after the end of the interaction.

Attributes and their meanings or use the following form appears briefly from:

<Form> </ from> form tag, usually never do register, login page, action = "" is stored in the form linked to back-end interface address, method representation requests, which get requests said it would later url parameter splicing ,by? To split, pass few parameters, POST request indicates parameters stored in the request body, such a request is safer manner, transmitting many parameters.

represents enctype encoding, wherein when enctype = 'application / x-www-form-urlencoded' browser will convert the parameter to a query string qs [format], when in the form of an attachment, be sure to set enctype enctype = "multipart / form-data" format.

Inside the name input: it can not be omitted, as the Key parameter, value: as a parameter value, the specified value MUST value button, type + text represents single text box for inputting the user name and the like. represents a block type + password password, etc. for entering the password. type + submit indicate the submit button for setting the click of a button, such as the Register button, login button and so on. type + file attachment represents a selector for uploading files. type + radio Represents a radio button to select the sex of radio events. type + checkbox express check button to select hobbies and other selected events. checked: single attribute value selected by default, set default value or the like is used. placeholder: prompt, prompt the user for input format prompt.

h5 expanding label (compatibility is not good, not strong) such as: E-mail: email, date of birth: date, progress bar: progress, etc.

select the drop-down list representation, where option label text displayed on the page, the value should be submitted in the value of option value, and when this value is not set, the author of the text is the label. Generally used for drop-down to select the year, month, day or regions and so on.

textarea multiline text field represents, in the form typically used to describe Profile like.

 

The following is my personal write a registry code is as follows:

<! DOCTYPE HTML>
<HTML lang = "EN">
<head>
<Meta charset = "UTF-. 8">
<title> Registration Form </ title>
</ head>
<body>
<form Action = "" Method = "POST">
<the Table>
<tbody>
<- user name ->!
<TR>
<td> username: </ td>
<td> <placeholder the iNPUT = "Please enter your user name" type = "text" = name "username"> </ td>
</ TR>
<- password ->!
<TR>
<td> password: </ td>
<td> <the INPUT of the type = "password" name = "password"> </ td>
</ TR>
<-! real name ->
<TR>
<td>真实姓名:</td>
<td><input type="text" name="name"></td>
</tr>
<!--邮箱-->
<tr>
<td>邮箱:</td>
<td><input type="text" name="email"></td>
</tr>
<!--性别-->
<tr>
<td>性别:</td>
<td>
<label for="gender_male"><input id="gender_male" type="radio" name="gender" value="male">男</label>
<label for="gender_female"><input id="gender_female" type="radio" name="gender" value="female" checked>女</label>
</td>
</tr>
<!--爱好-->
<tr>
<td>爱好:</td>
<td>
<label><input type="checkbox" name="hobby" value="lq">篮球</label>
<label><input type="checkbox" name="hobby" value="zq">足球</label>
<label><input type="checkbox" name="hobby" value="bq" checked>棒球</label>
<label><input type="checkbox" name="hobby" value="wq">网球</label>
</td>
</tr>
<!--地址-->
<tr>
<td>地址:</td>
<td>
<select name="province">
<option value="js">江苏</option>
<option value="sx">山西</option>
<option value="hn">湖南</option>
<option value="gd">广东</option>
<option value="jl">吉林</option>
<option value="hlj">黑龙江</option>
</select>省

<select name="city">
<option value="sz">苏州</option>
<option value="cs">长沙</option>
<option value="gz">广州</option>
<option value="cc">长春</option>
<option value="qqhe">齐齐哈尔</option>
<option value="ty">太原</option>
<option value="nj">南京</option>
<option value="fs">佛山</option>
<option value="heb">哈尔滨</option>
<option value="nt">南通</option>
<option value="jl">吉林</option>
</select>市

<input type="text" name="address"> 区/县
</td>
</tr>
<!--个人介绍-->
<tr>
<td>介绍:</td>
<td><textarea placeholder="请编写个人介绍" name="des" value="des" cols="46" rows="12"></textarea></td>
</tr>
<!--注册-->
<tr>
<td rowspan="2"><input type="submit" value="注册"></td>
</tr>
</tbody>
</table>
</form>
</body>
</html>

 

Registry in the following figure:

 

Guess you like

Origin www.cnblogs.com/lidyfamily/p/11272550.html