[mod_python] SELECT element values

Mike Looijmans nlv11281 at natlab.research.philips.com
Tue Oct 3 08:28:33 EDT 2006

Within a <SELECT> element, you will get the value attribute of the 
selected <OPTION> element. So if your HTML reads:

<select name="s">
<option value="1">One</option>
<option value="2">Two</option>

you will get either "1" or "2" as value for field "s", you will not get 
the "One" or "Two" strings because they're just eye-candy for the user.

Check the query string (part after "?" in the URL) to see how this works 
(change the form's method attribute from POST to GET if you don't see a 
query string in the URL).

Mike Looijmans
Philips Natlab / Topic Automation

Cristian Codorean wrote:
> Hello,
>  I have a simple form which I access easily
>    form_data = util.FieldStorage(req)
>    for field in form_data.list:
>        text = "%s = %s\n" % (field.name,field.value)
>        req.write(text)
> but in the case of html select elements I only get the index of the 
> selected
> element as the field value.

More information about the Mod_python mailing list