[Python-de] Hilfe bei cgi
Bernd
Bernd_Schmidt-SH at web.de
Tue Mar 26 23:57:45 EST 2002
Ich versuche mich gerade an cgi und brauche Hilfe, da ich nicht sehe, warum es nicht
so funktioniert, wie ich es mir denke.
Das cgi-Programm ist klein:
--------------------------------------------------------------------------
#!/usr/bin/python
import cgi
print 'Content-Type: text/html\n\n'
form = cgi.FieldStorage()
d = open("/home/bs/cgitst.txt", "w")
d.write(str(form))
d.close()
print 'form = <br>'
print str(form)
print '<br>'
print 'form.keys() = <br>'
print str(form.keys())
print '<br>'
for name in form.keys():
print 'Input: ' + name + ' Wert: ' + str(form[name].value) + '<br>'
print 'ende!!'
--------------------------------------------------------------------------
Nur es gibt bei mir nichts aus. Auch die Datei wird nicht angelegt,
geschweige denn etwas hinein geschrieben.
Wo ist mein Denkfehler bzw. warum klappt es nicht?
Das zugehörige HTML-Formular ist auch simpel:
<html>
<head>
<title>formtst</title>
</head>
<body>
<form action="http://localhost/cgi-bin/ftest.py" method="POST">
<P>Auswählen, eine oder viele:
<SELECT NAME=sections MULTIPLE>
<OPTION>Option1</OPTION>
<OPTION>Option2</OPTION>
<OPTION>Option3</OPTION>
</SELECT>
</P>
<input type="submit" checked name="Ok" value="ok">
<input type="reset" name="Abbruch" value="abbr">
</form>
</body>
</html>
More information about the Python-de
mailing list