[Tutor] Help with 500 error on cgi script

Kalle Svensson kalle@gnupung.net
Sun, 18 Mar 2001 14:24:49 +0100


Sez Sheila King:
> So, here is my script. I'm sure someone here will see it right off?

> #!/usr/bin/env python
> 
> 
> import cgi
> 
> form = cgi.FieldStorage()
> form_ok = 0
>     
> if form.has_key("subscriberEmail") and form.has_key("command"):
>     form_ok = 1
> if not form_ok:
> 	output = '''Content-type: text/html\n\n
> <html>
> <Head>
> <Title>Error in Form</Title>
> </Head>\n
> <Body>\n
> <H1>Error</H1>
> You have not filled out all necessary information to complete this request
> You <b>MUST</b> fill in your subscriber e-mail in the From: box
> and you <b>MUST</b> select some action to modify your delivery options.
> Please use the back button on your browser to return to the form and fill
> in the required information
> </body>\n</html>
> '''
> 	print output
> else:

Problem 1: No print "Content-type: text/html\n" here...

> 	for k in form.keys():
>     	print k, " : ", form[k]

Problem 2: The line above should be indented.

> 	print "All done!"
> 


Peace,
  Kalle
-- 
Email: kalle@gnupung.net     | You can tune a filesystem, but you
Web: http://www.gnupung.net/ | can't tune a fish. -- man tunefs(8)
PGP fingerprint: 0C56 B171 8159 327F 1824 F5DE 74D7 80D7 BF3B B1DD
 [ Not signed due to lossage.  Blame Microsoft Outlook Express. ]