[Tutor] CGI Question

SA sarmstrong13@mac.com
Mon, 08 Jul 2002 20:44:07 -0500

Hi Everyone-

The following is the test code in python:

#!/usr/bin/env python

import cgi

print "Content-Type: text/plain\n\n"

The_Form = cgi.parse_qs(pageID)

for pageID in The_Form.keys():
    print "The text file is: " + pageID
print "Finished!"

The following is my html code:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
<html lang="en">
    <title>CGI Test</title>
    <meta name="generator" content="BBEdit 6.5.2">
Click on the link below to test your CGI:
<a href="http://localhost/cgi-bin/test2?pageID=testtext"

The file testtext just has the single line:
Hello World!

When I click on the link I get a server error message. I have everythin
working correctly because I can run some other python cgi scripts that
display text messages no problem. The cgi program has the correct executable
permissions and is located in the correct directory.

So my question is, what am I doing wrong?

Parse_qs should take the pageID and produce a dictionary with pageID as the
key and testtext as the value, correct?

Do I need to read the value of testtext and store it in a variable to be
written to the display?