#!/usr/bin/python
import cgi
import cgitb
form = cgi.FieldStorage()
username = form.getvalue('name')
print 'Content-type:text/html\r\n\r\n'
print '<html>'
print '<head>'
print '<title>Text Adventure</title>'
print '</head>'
print '<body>'
print """
<form action="/game.py" method="post">
Enter Your Name: <input type="text" name="name"><br />
<input type="submit" value="Submit" />
</form>"""
print('Hello ' + username + ' pick a weapon from this list to start your fucking awesome adventure [sword, bat, bow]')
if username != '':
weapon = form.getvalue('weapon')
print """
<form action="/game.py" method="post">
Enter Weapon: <input type="text" name="weapon"><br />
<input type="submit" value="Submit" />
</form>"""
print '</body>'
print '</html>'
My problem is that I would like to be able to replace the first form input with the second one. Right now both forms appear on the page after you hit the first submit button.

New Topic/Question
Reply


MultiQuote

|