[Tutor] calling a CGI script

Kent Johnson kent_johnson at skillsoft.com
Fri Nov 5 02:08:54 CET 2004


It sounds like your web server is not configured for CGI scripts? or maybe 
the script is not executable? What OS and web server are you using?

Kent

At 03:49 PM 11/4/2004 -0800, Jeffrey Thomas Peery wrote:
>Hello I am trying to get a CGI script working, its my first time with 
>this.  I push my 'submit' button on my html document and my cgi script 
>appears on my browser, it doesn't seem to actually run the script. Any 
>ideas on whats wrong? Thanks, I included my html and my cgi below.
>
>
>Below is the test.html
>
><head>
><title>Test</title>
></head>
><body>
><h1>my form</h1>
>
><form action="c:/Program Files/Apache group/Apache/cgi-bin/test.cgi" 
>method="post">
><p>Name: <input type="text" name="myName" size="30" maxsize="50" /></p>
>
><p><input type="submit" value="Submit" />
></form>
></body>
>Below is the test.cgi file written in python
>
>#!c:\Program Files\Python\Python
>#test CGI
>import cgi
>import cgitb; cgitb.enable()
>
>form = cgi.FieldStorage()
>
>print "Content-Type: text/html"     # HTML is following
>print                               # blank line, end of headers
>
>if not form.has_key("myName"):
>     print "<H1>Error</H1>"
>     print "Please fill in the name field."
>     return
>print "<p>My Name is ", form["myName"].value
>_______________________________________________
>Tutor maillist  -  Tutor at python.org
>http://mail.python.org/mailman/listinfo/tutor



More information about the Tutor mailing list