How can I code to get more than One value from checkbox?

Shufen s4046441 at student.uq.edu.au
Thu Sep 30 15:03:05 EDT 2004


Hi,

I'm a newbie that just started to learn python, html and etc. I have
some questions to ask and hope that someone can help me on.

I'm trying to code a python script (with HTML) to get values from a
html form that consists of about 10 checkbox and a textbox where user
have to key in a value to perform a search.

>From python tutors, I learned that I have to use the following method:

###
qtype = data.getfirst('qtype')       ---- checkbox name
qtext = data.getfirst('qtext', '')   ---- textbox name
###

but I don't really know how to do it. Should I use qtype =
data.getlist('qtype') to get the value from the checkbox and how to?


Currently, my method required me to type in every possible combination
of the checkbox and I know that this is wrong. I wanna to include
%(qtype) in my query statement so that the script will look for the
value that contain qtype everytime a form is processs but the way I'm
doing now is wrong.

query = "select %(qtype)s from shot_descriptions where
shot_number=%(qtext)s", qtype, qtext


Thus, can someone help me on this.

Thank you for any help.

Shufen



More information about the Python-list mailing list