6 <meta http-equiv=
"Content-Type" content=
"text/html; charset=UTF-8" />
7 <title>Example page for HTML form handling
</title>
12 <!-- HTML forms can use GET or POST, and the encoding can be application/x-www-form-urlencoded or multipart/form-data.
13 If no method is specified (like <form method="method">), GET should be the default method.
14 If no encoding is specified, application/x-www-form-urlencoded should be the default.
15 Submit buttons may overwrite action, method and enctype by using formaction, formmethod and formenctype.
18 http://www.w3.org/TR/html401/interact/forms.html
19 http://www.w3schools.com/html/html_forms.asp,
20 http://www.w3schools.com/html/html_form_attributes.asp
21 http://www.w3.org/TR/html401/interact/forms.html#adef-enctype
25 <form action=
"/handle_form.embedded_c.example.callback">
26 See
<a href=
"http://www.w3schools.com/html/html_form_input_types.asp">HTML form tutorial
</a>
27 and
<a href=
"http://www.w3.org/TR/html401/interact/forms.html">HTML spec
</a>.
<br />
30 <legend>Text inputs:
</legend>
31 A text:
<input type=
"text" name=
"textin"><br />
32 A password:
<input type=
"password" name=
"passwordin"><br />
36 <legend>Radio set
1:
</legend>
37 <input type=
"radio" name=
"radio1" value=
"val1" checked
>val1
<br />
38 <input type=
"radio" name=
"radio1" value=
"val2">val2
<br />
39 <input type=
"radio" name=
"radio1" value=
"val3">val3
<br />
43 <legend>Radio set
2:
</legend>
44 <input type=
"radio" name=
"radio2" value=
"val1" checked
>val1
<br />
45 <input type=
"radio" name=
"radio2" value=
"val2">val2
<br />
46 <input type=
"radio" name=
"radio2" value=
"val3">val3
<br />
50 <legend>Checkboxes:
</legend>
51 <input type=
"checkbox" name=
"check1" value=
"val1" checked
>val1
<br />
52 <input type=
"checkbox" name=
"check2" value=
"val2">val2
<br />
53 <input type=
"checkbox" name=
"check3" value=
"val3">val3
<br />
57 <legend>HTML5 inputs:
</legend>
58 A number:
<input type=
"number" name=
"numberin" min=
"1" max=
"5"><br />
59 A date:
<input type=
"date" name=
"datein"><br />
60 A color:
<input type=
"color" name=
"colorin"><br />
61 A range:
<input type=
"range" name=
"rangein" min=
"1" max=
"5"><br />
62 A month:
<input type=
"month" name=
"monthin"><br />
63 A week:
<input type=
"week" name=
"weekin"><br />
64 A time:
<input type=
"time" name=
"timein"><br />
65 A datetime:
<input type=
"datetime" name=
"datetimen"><br />
66 A datetime-local:
<input type=
"datetime-local" name=
"datetimelocalin"><br />
67 An email:
<input type=
"email" name=
"emailin"><br />
68 A search:
<input type=
"search" name=
"searchin"><br />
69 A tel:
<input type=
"tel" name=
"telin"><br />
70 An url:
<input type=
"url" name=
"urlin"><br />
74 <legend>Files:
</legend>
75 A file:
<input type=
"file" name=
"filein"><br />
76 Multiple files:
<input type=
"file" name=
"filesin" multiple
><br>
80 <legend>Dropdown:
</legend>
81 <select name=
"selectin">
82 <option value=
"opt1">opt1
</option>
83 <option value=
"opt2">opt2
</option>
84 <option value=
"opt3">opt3
</option>
89 <legend>Text area:
</legend>
90 <textarea name=
"message" rows=
"10" cols=
"30">Text area default text.
</textarea>
94 <legend>Submit:
</legend>
96 <legend>Submit to Lua script:
</legend>
97 This will only work if server side Lua scripting is activated and /handle_form.lua can be found on the server.
99 <input type=
"submit" value=
"Submit" formmethod=
"POST" formenctype=
"multipart/form-data"
100 formaction=
"/handle_form.lua">
104 <legend>Submit to callback:
</legend>
105 This will work in the embedded_c example. It will call mg_handle_form_data to parse the request.
107 <input type=
"submit" value=
"Submit (form default)">
108 <input type=
"submit" value=
"Submit (GET)" formmethod=
"GET">
109 <input type=
"submit" value=
"Submit (POST)" formmethod=
"POST">
110 <input type=
"submit" value=
"Submit (POST, url-encoded)" formmethod=
"POST" formenctype=
"application/x-www-form-urlencoded">
111 <input type=
"submit" value=
"Submit (POST, form-data)" formmethod=
"POST" formenctype=
"multipart/form-data">