Checkboxes (Hộp kiểm) được sử dụng khi cần chọn nhiều hơn một tùy chọn.
Ví dụ
Dưới đây là mã HTML ví dụ cho biểu mẫu với hai hộp kiểm:
<form action = "/cgi-bin/checkbox.cgi" method = "POST" target = "_blank"> <input type = "checkbox" name = "maths" value = "on" /> Maths <input type = "checkbox" name = "physics" value = "on" /> Physics <input type = "submit" value = "Select Subject" /> </form>
Đầu ra
Kết quả của mã này là biểu mẫu sau:

Dưới đây là script checkbox.cgi để xử lý đầu vào từ trình duyệt web cho hộp kiểm:
#!/usr/bin/python
# Nhập mô-đun để xử lý CGI
import cgi, cgitb
# Tạo thể hiện FieldStorage
form = cgi.FieldStorage()
# Lấy dữ liệu từ trường
if form.getvalue('maths'):
math_flag = "ON"
else:
math_flag = "OFF"
if form.getvalue('physics'):
physics_flag = "ON"
else:
physics_flag = "OFF"
print "Content-type:text/html\r\n\r\n"
print ""
print ""
print "Checkbox - Third CGI Program "
print ""
print ""
print " CheckBox Maths is : %s
" % math_flag
print " CheckBox Physics is : %s
" % physics_flag
print ""
print ""