HTML (index.html):
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | < form action = "test.php" name = "test" id = "test" enctype = "multipart/form-data" method = "post" > < fieldset > < legend >Hello CodeBoxy</ legend > Text : < input type = "text" name = "t1" id = "t1" value = "TEXT" />< br /> Password : < input type = "password" name = "p1" id = "p1" value = "password" />< br /> Hidden : < input type = "hidden" name = "h1" id = "h1" value = "hidden" />< br /> Button : < input type = "button" name = "b1" id = "b1" value = "Enable" /> < input type = "button" name = "b2" id = "b2" value = "Disabled" disabled = "disabled" />< br /> File : < input type = "file" name = "f1" id = "f1" />< br /> Checkbox : < input type = "checkbox" name = "c1" id = "c1" checked = "checked" />QQBoxy < input type = "checkbox" name = "c2" id = "c2" />CodeBoxy< br /> Radio : < input name = "r1" id = "r1" type = "radio" checked = "checked" />QQBoxy < input name = "r1" id = "r2" type = "radio" />CodeBoxy< br /> Select : < select name = "s1" id = "s1" > < optgroup label = "QQBoxy" > < option value = "1-1" >1-1</ option > </ optgroup > < optgroup label = "CodeBoxy" > < option value = "2-1" selected = "selected" >2-1</ option > < option value = "2-2" >2-2</ option > </ optgroup > </ select >< br /> Textarea :< br /> < textarea name = "a1" id = "a1" cols = "40" rows = "2" >Hello CodeBoxy</ textarea >< br /> < input type = "image" src = "qqboxy.gif" />< input type = "submit" />< input type = "reset" /> </ fieldset > </ form > |
1 | $test = ! empty ( $_GET [ 'test' ]) ? $_GET [ 'test' ] : null; |
1 | $test = ! empty ( $_POST [ 'test' ]) ? $_POST [ 'test' ] : null; |
說明:
簡單展示常用HTML Form語法,補充PHP為GET與POST接收語法。
沒有留言:
張貼留言