[medusa] Trouble with the CGI
Ernesto Nadir Crespo Avila
ecrespo@u...
Tue, 10 Apr 2001 23:16:25 -0400
El Mar 10 Abr 2001 12:24, escribiste:
> It's been a while since I've workd with cgi.py but I believe your problem
> is in reading datos['name']. Try datos['name'].value instead.
> datos['name'] may contain a list or string, so adapt your code accordingl=
y.
Thank you.
But, now just appear:
there´s no data
And
FieldStorage(None, None, [])
Bye, Ernesto Crespo
# -*- Mode: Python; tab-width: 4 -*-
# send and process a POST form
import cgi
print '<html>'
print '<head>'
print '<meta http-equiv="Content-type" content="text/html">'
print
print '<title> A Cgi example with Phyton</title>'
print '</head>'
print '<body>'
datos = cgi.FieldStorage()
if datos.has_key('name'):
print '<h1> Your data: %s</h1>' %datos['name'].value
else:
print '<h1>there´s no data</h1>'
print datos
print '</body>'
print '</html>'