如何指定 HTML 中提交至伺服器時表單資料是否應編碼?
在 HTML 中使用 enctype 屬性來設定在提交至伺服器期間表單資料是否應編碼。
示例
你可以嘗試執行以下程式碼來實現 enctype 屬性 -
<!DOCTYPE html> <html> <body> <p>Which sports do you like?</p> <form action = "" method = "post" enctype = "multipart/form-data"> <input type = "checkbox" name = "vehicle" value = "football" checked> Football<br> <input type = "checkbox" name = "vehicle" value = "cricket" checked> Cricket<br> <input type = "checkbox" name = "vehicle" value = "hockey"> Hockey<br> <input type = "submit" value = "Submit"> </form> </body> </html>
廣告