HTML ??
???? ?????
??? ??? ?? ??? ??? ??? ??? ????? ???????. :
?????
???
???
?? ???
??S?? ?
HTML ??
??? ?? ??? ???? ?????. ? ????? ?? ??? ?? ? ??? ??? ?? ??? ???? ?? ?? ??? ?? ??? ??? ? ????.
?? ??? ???? ???? ??? ??? ?? ???? ??? ? ????. ??(??? ??), ???? ??, ??? ??, ???? ?
?? ?? <form>? ???? ??? ?????.
<form method="?? ??" action="?? ?? ??">
.input ??
</form>
?? ? ??? ?? ?? ???? ???? ??? ???? ? ?????. ????? ??? ?? ?? ????? ?????. PHP ??? ?????.
??? ? GET ?? POST? ? ????. ???? ??? ??? ???? GET???. ??? ???? ?? POST ? GET? ???? ???? ???? ?????. ???? ??? ????? ?? ? ? ????. Post? HTTP ?? ????? ???? ? ??? ??? ???? ?? ??? HTML HEADER? ?????. ACTION ??? ???? URL ??? ? ? ????)
HTML ?? - ?? ??
???? ??? ???? form ??? ?? ??(<input>)???.
?? ??? ?? ??(type)? ?? ?????. ?? ????? ???? ?? ??? ??? ????.
??? ??
??? ??? <input type="text"> ??? ?? ????, ???? ??? ??, ?? ?? ???? ?? ??? ??? ?????.
Instance
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>php中文網(wǎng)(php.cn)</title> </head> <body> <form> 文本域: <input type="text" name="firstname"><br> 文本域: <input type="text" name="lastname"> </form> </body> </html>
????? ??? ?? ?????.
???? ??
???? ??? <input type="password"> ??? ?????:
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>php中文網(wǎng)(php.cn)</title> </head> <body> <form> 姓名: <input type="text" name="firstname"><br> 密碼: <input type="password" name="lastname"> </form> </body> </html>
????? ??? ?? ?????.
??: ???? ?? ??? ?? ???? ???? ??? ???? ?????. ?? ?? ?.
??? ??
<input type="radio"> ??? ??? ?? ??? ?????.
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>php中文網(wǎng)(php.cn)</title> </head> <body> <form> <input type="radio" name="sex" value="male">男<br> <input type="radio" name="sex" value="female">女 </form> </body> </html>
? ????? ??? ?? ?????.
Checkbox
<input type="checkbox"> ???? ??? ?? ?? ?? ??? ???? ???. ?? ???? ?? ?? ?? ?? ??? ?????.
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>php中文網(wǎng)(php.cn)</title> </head> <body> <input type="checkbox" name="vehicle" value="自行車">自行車 <input type="checkbox" name="vehicle" value="汽車">汽車 <input type="checkbox" name="vehicle" value="飛機(jī)">飛機(jī) <input type="checkbox" name="vehicle" value="輪船">輪船 </body> </html>
????? ??? ?? ?????.
?? ??
<input type="submit">? ?? ??? ?????.
???? ?? ??? ???? ??? ??? ?? ??? ?????. ??? ?? ??? ?? ??? ?? ??? ?????. action ???? ??? ??? ????? ??? ?? ???? ?? ?? ??? ?????. :
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>php中文網(wǎng)(php.cn)</title> </head> <body> <form name="input" action="action.php" method="post"> 用戶名 <input type="text" name="user"><br/> 密 碼 <input type="password" name="user"> <input type="submit" value="Submit"> </form> </body> </html>
????? ??? ?? ?????.
?? ??? ??? ? ??? ??? ? ?? ??? ???? ??? ???? "action.php" ???? ???? ?????. ? ????? ??? ??? ?????.
HTML ?? ??
標(biāo)簽 | 描述 |
<form> | 定義供用戶輸入的表單 |
<input> | 定義輸入域 |
<textarea> | 定義文本域 (一個(gè)多行的輸入控件) |
<label> | 定義了 <input> 元素的標(biāo)簽,一般為輸入標(biāo)題 |
<fieldset> | 定義了一組相關(guān)的表單元素,并使用外框包含起來 |
<legend> | 定義了 <fieldset> 元素的標(biāo)題 |
<select> | 定義了下拉選項(xiàng)列表 |
<optgroup> | 定義選項(xiàng)組 |
<option> | 定義下拉列表中的選項(xiàng) |
<button> | 定義一個(gè)點(diǎn)擊按鈕 |
<datalist> | 指定一個(gè)預(yù)先定義的輸入控件選項(xiàng)列表 |
<keygen> | 定義了表單的密鑰對生成器字段 |
<output> | 定義一個(gè)計(jì)算結(jié)果 |
HTML ?? ??? ?? ??? ????? HTML ?? ???? ?????.
? ?? ?? ???
? ?? HTML ???? ??? ???? ?? ??? ??? ??? ?????. ???? ?? ??? ?? ??? ?????. ?? ??? ?? ??? ???? ?????.
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>php中文網(wǎng)(php.cn)</title> </head> <body> <form action=""> <select name="學(xué)歷"> <option value="小學(xué)">小學(xué)</option> <option value="初中">初中</option> <option value="大專" selected>大專</option> <option value="本科">本科</option> <option value="碩士">碩士</option> <option value="博士">博士</option> </select> </form> </body> </html>
???? ?? ??:
? ???? ??? ??? ??? ??? ?????. (?? ? ??? ?? ???). ???? ??? ??? ???? ? ? ????. ?? ?? ?? ??? ??? ????. ??? ???? ??? ??? ? ????.
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>php中文網(wǎng)(php.cn)</title> </head> <body> <form action=""> <textarea rows="8" cols="20"> 我是一個(gè)文本框。 </textarea> <input type="button" value="提交"> </form> </body> </html>
???? ?? ??:
?? ????
? ???? ???? ??? ???? ??? ?????. ? ???? ?? ??, ??? ??, ??? ??, ???, ???? ?? ? ?? ??? ???? ????.
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>php中文網(wǎng)(php.cn)</title> </head> <body> <form action="form.php" method="post"> 作者: <input type="text" name="Name" ><br> 文本內(nèi)容:<br/> <textarea rows="8" cols="20"> </textarea><br/> <input type="radio" name="sex" value="男">男<input type="radio" name="sex" value="女">女<br/> <select name="學(xué)歷"> <option value="小學(xué)">小學(xué)</option> <option value="初中">初中</option> <option value="大專" selected>大專</option> <option value="本科">本科</option> <option value="碩士">碩士</option> <option value="博士">博士</option> </select> <input type="submit" value="提交"> </form> </body> </html>
???? ?? ??:
"??" ??? ???? ?? ???? ?? ???? form.php ???? ?????. ???
?
? ?? ???? ???? ??? ??? ?????.
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>php中文網(wǎng)(php.cn)</title> </head> <body> <form action="form.php" method="post"> 姓名:<br> <input type="text" name="name" ><br> E-mail:<br> <input type="text" name="mail" ><br> 你的意見:<br> <textarea cols="20" rows="2"> </textarea><br/> <input type="submit" value="發(fā)送"> <input type="reset" value="重置"> </form> </body> </html>
???? ?? ??:
"??" ??? ???? ?? ???? form.php ???? ???? ??? ? "???" ??? ???? ??? ??? ?????.