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 type= "text" name= "username"/> <label for= "pass" > Password:</label> < Input type= "password" name= "pass"/></form>
Text input box, password entry box
A text input box is used when the user wants to type something like letters, numbers, and so on in the form. The text box can also be converted into a password entry box .
Syntax :
<form> <input type= "Text/password" name= "name" value= "text"/></form>
1
、type:
当type="text"时,输入框为文本
Input box;
当type="password"时,
输入框为密码输入框。
2
、name:
为文本框命名,以备后台程序ASP 、PHP使用。
3
、value:
为文本输入框设置默认值。(一般起到提示作用)
举例
:
<form> Name: <input type= "text" name= "MyName" > <br/> Password: <input type= " Password "name=" pass "></form>
Results displayed in the browser:
Text fields, multi-line text input support
Text input fields are required when users need to enter large pieces of text in the form.
Syntax :
<textarea
rows="
行数"
cols="
列数"
>
文本</textarea>
1
、<textarea>标签是成对出现的,以<textarea>开始,以</textarea>结束。
2
、cols :
多行输入域的列数。
3
、rows :
多行输入域的行数。
4
、在<textarea></textarea>标签之间可以输入默认值。
举例
:
<form method= "POST" action= "save.php" > <label>
联系我们</label>
<textarea cols="50" rows="10" >
在这里输入内容...
</textarea>
</form>
Display the results in the browser:
HTML Interaction, Forms