CGI getting multiple values with same name into a list

Lee Joramo ljoramo.list at
Mon May 8 22:33:34 CEST 2000

I am trying to process a web form but can not figure out the proper way to
get mulitple values with the same name into a list. However, instead of
getting a nice list, I get garbled MiniFieldStorage results For example, I
have an html checkbox set with the name "select":

--html web form snippet --
	<form method=GET action='cgi-bin/'>
	<input type=hidden name="formname" value="form1">
	<input type=checkbox checked name='select' value='type'> type
	<input type=checkbox checked name='select' value='year'> year
	<input type=checkbox checked name='select' value='price'> price
	<input type=checkbox  name='select' value='description'> description
	<input type=checkbox  name='select' value='template'> template


When the form is submited it passes these values to a python script:



import cgi
form = cgi.FieldStorage()

print "Content-Type: text/html\n\n"
print "<pre>"

formname = form['formname'].value
print "formname : %s" % formname
try :
	select = form['select'].value
	print "TRY select : %s" % select
except :
	select = form['select']
	print "EXCEPT select: %s" % select

--output of

formname : form1
EXCEPT select: [MiniFieldStorage('select', 'type'),
MiniFieldStorage('select', 'year'), MiniFieldStorage('select', 'price')]


Of course, what I am looking for is something like:

select == ['type', 'year', 'price']

Thanks for any help.

Lee A. Joramo                      ljoramo at
The Nickel Want Ads      
Internet Manager                   970-242-5555


Onward and Upward!

Lee A. Joramo }}-----> Cowboy on the Electronic Frontier

lee at

Alamar Ranch  -  Palisade  -  Colorado


More information about the Python-list mailing list