Newbie cgi module question

Michael Hall olc at ninti.com
Wed Jul 3 23:35:08 EDT 2002


Thanks to Jeff for sorting out that last MySQLdb/tuple/list question
(solution was spot on).
B
Another newbie question here ...

Does Python's cgi module handle simultaneous get/post data?
For example, I tried to use something like this:

<form action="names.py?action=edit" method="post>
<input type="text" name="thingtoedit">
<input type="submit" name="submit" value="submit">
</form>

I attempted to access the values above as follows:

data = cgi.FieldStorage()
action = data['action'].value
thingtoedit = data['thingtoedit'].value

When submitted to the target script (names.py), the 'action' parameter
and it's value in the query string seem to be invisible to the script.
If I use a hidden field like this, everything works fine:

<form action="names.py" method="post>
<input type="text" name="thingtoedit">
<input type="hidden" name="action" value="edit">
<input type="submit" name="submit" value="submit">
</form>

The first example would work fine in PHP ... maybe Python is just
different on this point?

TIA again

Michael Hall







More information about the Python-list mailing list