If it is a small script, I have always redirected the scripts back to itself. Of course with this method you have to account for both data and no data and displaying the html with the same script, but then again its a small script anyways.
this is a real raw limited example
- Code: Select all
import cgitb; cgitb.enable()
form = cgi.FieldStorage()
html = """Content-type: text/html\n
<b>cgi.FieldStorage() is: <br></b>
<form name="input" action="test1.py" method="get">
Enter something: <input type="text" name="something">
<input type="submit" value="Submit">
where obviously this scripts name is test1.py
So basically the form calls the same script, giving the data via url, but python has to handle when fieldStorage both has data and does not
I havent done cgi in awhile though so i might not be up to par.