Get the App
SLTechnology News&Howtos  ›  Development  › 

How to transfer checkbox data through CGI program

Shulou Source: shulou.com Published: 2022-06-01 01:33:23 10月04日 Update

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)

Google

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!

Tags: Data programs examples selection code content more knowledge practicality learning next dilemma multiple fields actual situation files articles permissions cases Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Redmi Apple Shulou Tech Info OPPO Reno MariaDB