I've got a simple page here, titled login.py for the time being since eventually it will be a functional login page. However, right now I've got it set up to try to get POST variables from the form being submitted. This is the code I have so far:
from mod_python import apache, Session, util
from time import time
import webout
def index(req):
form = util.FieldStorage(req)
testval = form.getfirst("test")
return webout.htmlout("", """
<form name="login" action="login.py" method="post">
<h2>%s</h2>
<p>Enter something:</p><input type="text" name="test">
<input type="submit" value="Submit">
</form>
""" % testval)
Webout is a module I wrote, essentially all it does is return a properly formatted HTML output so I don't have to type it out all the time, calling htmlout I am passing in what would go in the head and body.
Anyway, if I were to change the form's method to get, the h2 properly displays whatever I submit in the text box in the form. However, if I change it to post, I get None (so I'm assuming null). What else do I have to do to reference POST variables?