[Tutor] calling a CGI script

Jeffrey Thomas Peery jeffpeery at yahoo.com
Fri Nov 5 00:49:36 CET 2004

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






<h1>my form</h1>


<form action="c:/Program Files/Apache group/Apache/cgi-bin/test.cgi"

<p>Name: <input type="text" name="myName" size="30" maxsize="50" /></p>


<p><input type="submit" value="Submit" />



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."


print "<p>My Name is ", form["myName"].value

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20041104/0fada4a1/attachment.htm

More information about the Tutor mailing list