I am trying to experiment with python's cgi module, ad do't want to buy an entire server just to accomplish this task. So I have written my html and python cgi script on my Ubuntu 14.04 computer, but the script will not run. Here is the relevant HTML code:
<form action = "cgi-bin/Login.py" method="get"> Username <input type = "text" name = "user"><br> Password: <input type = "password" name = "password"><br> <input type = "submit" value = "Submit"><br> </form>
And the Python 3 Code
import cgi, cgitb form = cgi.FieldStorage() # Get data from fields Username = form.getvalue('user') Password = form.getvalue('password') print ("Content-type:text/html") print () print ("<html>") print ("<head>") print ("<title>Hello - Second CGI Program</title>") print ("</head>") print ("<body>") print ("<h2>Hello %s %s</h2>" % (Username, Password)) print ("</body>") print ("</html>")
And lastly the popup that I get when I click the submit button on the webpage.
You'll need to setup and configure a web server to serve the cgi scripts. Here's the apache documentation on that.