cgi and form NEED HELP!

jmdeschamps jmdeschamps at cvm.qc.ca
Mon Oct 7 10:24:17 EDT 2002


"CheapSkate" <gua81 at XXXyahoo.com> wrote in message news:<anqlql$7be$1 at lust.ihug.co.nz>...
> hi, need a little help here.
> I'm having a list of items with checkboxses in them.
> the name attribute is unknow for each one(generated automatically).
> 
> now what I want to do is that
> in the cgi.FieldStorage(), I want it to contain all the names of the checked
> boxes.
> any idea?
> 
> 
> Here's the code for the checkbox:
> print '<input type="checkbox" name="%s" size="20"><a href=%s>%s</a></td>'%
> (filename, fullname, filename)
> 
> where filename is the filename of the file e.g apple
> and fullname is the fullpath to the file e.g C:\windows\desktop\apple
> 
> Cheers.

>From the CGI module documentation, section: 11.2.2 Using the cgi
module
...
Form fields containing empty strings are ignored and do not appear in
the dictionary; to keep such values, provide a true value for the the
optional keep_blank_values keyword parameter when creating the
FieldStorage instance.
...

someVar = cgi.FieldStorage(keep_blank_values = 1)

someVar will contain all your form items ...

Have a good week

Jean-Marc



More information about the Python-list mailing list