HTML form

How does the website interact with users? The answer is to use HTML forms. The form can transmit the data entered by the viewer to the server, so that the server-side program can process the data passed by the form.

Grammar:

<form   method="传送方式"   action="服务器文件">

Explanation:

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

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

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

<form    method="post"   action="save.php">
        <label for="username">用户名:</label>
        <input type="text" name="username" />
        <label for="pass">密码:</label>
        <input type="password" name="pass" />
</form>

Note:

1. All form controls (text boxes, text fields, buttons, radio boxes, check boxes, etc.) must be placed Between the <form></form> tags (otherwise the information entered by the user may not be submitted to the server!).

2. Method: The difference between post/get. This part is a matter for back-end programmers to consider. Interested friends can check the wiki of this section, which has detailed introduction.

Continuing Learning
||
<html> <head> <style> div#container{width:1000px} div#header {background-color: royalblue ;height: 100px;text-align:center;font-size: 20px} div#sidebar{background-color: darkorange;height:400px;width:300px;float:left;} div#mainbody {background-color: forestgreen;height:400px;width:700px;float:left;} div#footer {background-color: powderblue;height: 100px;clear:both;text-align:center;} </style> </head> <body> <div id="container"> <div id="header"> <h1>php中文网</h1> </div> <div id="sidebar"> <dl> <dt>list of book</dt> <dd> <ol> <li>hadoop</li> <li>linux</li> <li>c</li> </ol> </dd> </dl> </div> <div id="mainbody"> <h1>the summary of the book</h1> <p>i will lead you to travel in the season of linux</p> <form> <input type="checkbox" name="married" /> married <br/> <input type="checkbox" name="have a job" /> have a job <br/> <input type="checkbox" name="chinese" /> chinese </form> </div> <div id="footer">good good study day day up</div> </div> </body> </html>
submitReset Code
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!