print "Content-type: text/html" # HTML text follows
print # blank line: end headers
print "
CGI script output"
form = cgi.FieldStorage()
form_ok = 0
if form.has_key("name") and form.has_key("addr"):
if (form["name"].value != "" and
form["addr"].value != ""):
form_ok = 1
if not form_ok:
print "Error
"
print "Please fill in the name and addr fields."
return
...more form processing here...