0
我想要有两个不同的提交按钮。如果一个提交按钮被按下,那么它将转到一个cgi脚本,如果另一个按钮被转到另一个。现在下面是我的代码,但它不工作,因为我想要它。无论按下哪一个脚本,它们都只能使用相同的脚本。两个不同的提交按钮html/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>'
不知道你的意思究竟是什么,心中张贴一个例子什么的?谢谢 – Neemaximo
我真的不知道你使用的语言。我只是跑过这个帖子,以为我会给我2美分。你弄明白了吗?你使用了什么代码? –