How to transfer checkbox data through CGI program
This article introduces the relevant knowledge of "how to transfer checkbox data through CGI programs". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
Transfer checkbox data through CGI program
Checkbox is used to submit one or more option data. The HTML code is as follows:
(yisu.com)
The following is the code for the checkbox.py file:
Example
#! / usr/bin/python3
# introducing CGI processing module
Import cgi, cgitb
# create an instance of FieldStorage
Form = cgi.FieldStorage ()
# receive field data
If form.getvalue ('google'):
Google_flag = "Yes"
Else:
Google_flag = "No"
If form.getvalue ('yisu'):
Runoob_flag = "Yes"
Else:
Runoob_flag = "No"
Print ("Content-type:text/html")
Print ()
Print ("")
Print ("")
Print ("")
Print ("CGI Test instance")
Print ("")
Print ("")
Print ("whether:% s"% runoob_flag is selected)
Print ("whether Google selected:% s"% google_flag)
Print ("")
Print ("")
Modify checkbox.py permissions:
Chmod 755 checkbox.py "how to transfer checkbox data through CGI programs" is introduced here. Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!