Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
cgi script help
#1
i follow the python guide to write a html and cgi script as follow in pyCharm on a macbook,however,i got 404 error after i click submit

the html
Output:
<html> <title>Interactive Page</title> <body> <form method=POST action="cgi-bin/cgi101.py"> <P><B>Enter your name:</B> <P><input type=text name=user> <P><input type=submit> </form> </body></html>
the cgi script
#!/usr/bin/python
import cgi
form = cgi.FieldStorage()
print('Content-type: text/html\n')
print('<title>Reply Page</title>')
if not 'user' in form:
    print('<h1>Who are you?</h1>')
else:
    print('<h1>Hello <i>%s,</i>!</h1>' % cgi.escape(form['user'].value))
Reply


Messages In This Thread
cgi script help - by xiayao - Jul-14-2018, 03:20 AM
RE: cgi script help - by gontajones - Jul-14-2018, 12:08 PM
RE: cgi script help - by xiayao - Jul-15-2018, 02:45 AM
RE: cgi script help - by gontajones - Jul-16-2018, 10:34 AM
RE: cgi script help - by xiayao - Jul-17-2018, 02:26 AM
RE: cgi script help - by gontajones - Jul-17-2018, 09:52 AM
RE: cgi script help - by xiayao - Jul-18-2018, 02:18 AM
RE: cgi script help - by gontajones - Jul-18-2018, 08:51 AM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020