[Tutor] CGI/Python

Matthias Hager martok@mattsmail.com
Sun, 28 Jan 2001 19:37:55 -0800


#!/usr/bin/python
#
# cheezy2.cgi
#
 
import cgi
 

print "Content-type: text/html\n"
 
form = cgi.FieldStorage()
form_ok = 0
if form.has_key("name") and form.has_key("addr"):
    form_ok = 1
################################
if not form_ok:
## try changing to 'else:'
## I don't understand why you actually need the form_ok
## I could be wrong, it could be part of the CGI, but else it isn't ## needed, hope this works, I'm fairly new to Python

    print "<H1>Error</H1>"
    print "Please fill in the name and addr fields."
    return
print form["name"].value
print form["addr"].value


--
Programming isn't cool, it's awesome.

%%%################?????????###################^^^
                                          
          martok@mattsmail.com              
      http://mymymatthias.tripod.com/       
                                            
%%%################????????####################^^^         


--



Like my email address? Get your own for FREE at http://firstname.com 
Get you@JohnsMail.com or you@AlexsMail.com or pick from 500 more!