I am trying to create a cgi form that will allow a user to type in a word and then it will take that word and send it off to the next page (another cgi). I know how to do it with a .html file but I am lost when it comes to doing it with python/cgi.
Here is what I need to do but it is in html.
<html>
<h1>Please enter a keyword of your choice</h1>
<form action="next.cgi" method="get">
Keyword: <input type="text" keyword="keyword"> <br />
<input type="submit" value="Submit" />
</form>
</html>
Does anyone know how to create a submit button with cgi? Here is what I have so far.
import cgi
import cgitb
cgitb.enable()
form = cgi.FieldStorage()
keyword = form.getvalue('keyword')
To display html from a Python cgi page you need to use the print statement.
Here is an example using your code.
Then on your next.cgi page you can get the values submitted by the form. Something like: