posted May 19, 2014, 7:56 AM by Samuel Konstantinovich   [ updated May 19, 2014, 7:56 AM ]
Notes from class:

import cgi,cgitb

formData = cgi.FieldStorage()

#if you get a submitted form:
if 'filename' in formData and 'page' in formData:
    print '<h3>Do stuff with the form</h3>\n'

    pageNumber = formData['page'].value #string of the page number
    fileName = formData['filename'].value #string of the fileName

    print "the page number is:",pageNumber,"<br>"
    print "the file name is:",fileName,"<br>"

    nextPage = str(int(pageNumber)+1) #add one to the page number

    #build a link and don't forget the & between the variables
    linkToNextPage = '''<a href = "displayForm.py?filename='''+ fileName + "&page="+nextPage+'''">next page</a><br>'''

    print linkToNextPage
#else you didn't get a submitted form:
    print '''
 <form action="displayForm.py">
 filename: <input type="text" name="filename"><br>
 <input type="hidden" name="page" value="1">
 <input type="submit">