How to transfer drop-down data through CGI program
This article mainly introduces "how to transfer pull-down data through CGI program". In daily operation, I believe many people have doubts about how to transfer pull-down data through CGI program. Xiaobian consulted all kinds of materials and sorted out simple and easy operation methods. I hope to help you answer the doubts about "how to transfer pull-down data through CGI program"! Next, please follow the small series to learn together!
Pull-down data transfer via CGI program
HTML drop-down box code is as follows:
Rookie tutorial (runoob.com)
Rookie tutorial
The dropdown.py script code looks like this:
#!/ usr/bin/python3
#Introduction of CGI processing module
import cgi, cgitb
#Create an instance of FieldStorage
form = cgi.FieldStorage()
#Receive field data
if form.getvalue('dropdown'):
dropdown_value = form.getvalue('dropdown')
else:
dropdown_value = "No content"
print ("Content-type:text/html")
print ()
print ("")
print ("")
print ("")
print ("Beginner Tutorial CGI Test Case")
print ("")
print ("")
print ("Selected option is: %s" % dropdown_value)
print ("")
print ("")
Modify dropdown.py permissions:
chmod 755 dropdown.py At this point, the study of "how to pass drop-down data through CGI programs" is over, hoping to solve everyone's doubts. Theory and practice can better match to help everyone learn, go and try it! If you want to continue learning more relevant knowledge, please continue to pay attention to the website, Xiaobian will continue to strive to bring more practical articles for everyone!