Two different submit buttons html/cgi form

annapelican

New Member
I am trying to have two different submit buttons. If one submit button is pressed then it goes to one cgi script and if the other is pressed it goes to another. Right now below is my code but it isn't working as I want it to. They both only go to the same script regardless of which one is pressed.\[code\]#!/usr/bin/env pythonimport cgiimport cgitbcgitb.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 = ", keysetprint '<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="http://stackoverflow.com/questions/13864457/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="http://stackoverflow.com/questions/13864457/Submit" name="Submit2" />'print '</html>'\[/code\]
 
Back
Top