私はPythonを学んでいるので、本からこの演習を取得しました。これはhtmlフォームです。
<html>
<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>
そして、これは呼び出すスクリプトです:
#!/usr/bin/python3
import cgi
form = cgi.FieldStorage()
# parse form data
print('Content-type: text/html\n')
# hdr plus blank line
print('<title>Reply Page</title>')
# html reply page
if not 'user' in form:
print('<h1>Who are you?</h1>')
else:
print('<h1>Hello <i>%s</i>!</h1>' % cgi.escape(form['user'].value))
ロジックにより、ユーザーを入力すると、印刷する必要があります