企业🤖AI Agent构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
# 表单 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 的不同 ![](https://box.kancloud.cn/6f33abd799260540860b9b27af2b42de_673x484.png) ~~~ <!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 ![](https://box.kancloud.cn/3d271948c1ea752b7088a248c09ffc42_877x348.png) ## post ![](https://box.kancloud.cn/7b791cbfe2db49dc99026cbfa469d8fa_749x441.png)