# 表單
HTML 表單用于搜集不同類型的用戶輸入
* * * * *
基本結構
~~~
<form action="form_action.asp" metho="get" enctype="text/plain">
<p>First name: <input type="text" name="fname" /></p>
<p>Last name: <input type="text" name="lname" /></p>
<input type="submit" value="Submit" />
</form>
~~~
| 屬性 | 值 | 描述 |
|--|--|--|
|action | URL | 規定當提交表單時向何處發送表單數據。 |
| enctype | 見說明 | 規定在發送表單數據之前如何對其進行編碼。 |
| method | get post | 規定用于發送 form-data 的 HTTP 方法。 |
| name | *form_name* | 規定表單的名稱。 |
注意
必需的 **action** 屬性規定當提交表單時,向何處發送表單數據。
**enctype**
|值|描述|
|--|--|
| application/x-www-form-urlencoded | 在發送前編碼所有字符(默認) |
| multipart/form-data | 不對字符編碼。在使用包含文件上傳控件的表單時,必須使用該值。 |
| text/plain | 空格轉換為 "+" 加號,但不對特殊字符編碼。 |
** input type**
> button
> checkbox
> file
> hidden
> image
> password
> radio
> reset
> submit
> text
# 示例
get post 的不同

~~~
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>表單</title>
</head>
<body>
<form action="#" method="get" accept-charset="utf-8">
學號 <input type="text" name="num-g" /><br/><br/> 姓名
<input type="text" name="name-g" /><br/><br/> 班級
<input type="text" name="classs-g" /><br/><br/>
<input type="submit" value="提交啦-get" />
</form>
<form action="#" method="post" accept-charset="utf-8">
學號 <input type="text" name="num-p" /><br/><br/> 姓名
<input type="text" name="name-p" /><br/><br/> 班級
<input type="text" name="classs-p" /><br/><br/>
<input type="submit" value="提交啦-post" />
</form>
</body>
</html>
~~~
## get

## post
