2 つの異なる送信ボタンを使用しようとしています。1 つの送信ボタンが押されると 1 つの CGI スクリプトに移動し、もう 1 つのボタンが押されると別の CGI スクリプトに移動します。現在、以下は私のコードですが、思い通りに機能していません。どちらが押されても、両方とも同じスクリプトにのみ移動します。
#!/usr/bin/env python
import cgi
import cgitb
cgitb.enable()
form = cgi.FieldStorage()
keyword = form.getvalue('keyword')
keyset = set(x.strip() for x in open('keywords.txt', 'r'))
print 'Content-type: text/html\r\n\r'
print '<html>'
print "Set = ", keyset
print '<h1>If your keyword is in the set, use this submission button to retrieve recent tweets</h1>'
print '<form action="results.cgi" method="post">'
print 'Keyword: <input type="text" name="keyword"> <br />'
print '<input type="submit" value="Submit" name="Submit1" />'
print '</html>'
print 'Content-type: text/html\r\n\r'
print '<html>'
print '<h1>If your desired keyword is not in the set, use this submission button to add it</h1>'
print '<form action="inlist.cgi" method="post">'
print 'Keyword: <input type="text" name="keyword"> <br />'
print '<input type="submit" value="Submit" name="Submit2" />'
print '</html>'