[Tutor] html and mod_python
Patty
patriciap.gu at gmail.com
Thu Mar 23 02:54:00 CET 2006
Hi!
I created a form in a python file that takes values selected from 6 different
drop down boxes:
for target in all_targets:
s = s + "<form action='process_info' method='POST'>"
s = s + "<input type='hidden' name='tg' value=%s>" % target
s = s + "<tr><td></td>"
for host in hosts:
if target in ants_map[host]:
s = s + printbox()
else:
s = s + printemptybox()
s = s + """<td><input type='submit' value='Submit'></td></tr>"""
s = s + "</form>"
My printbox method contains the following:
def printbox():
tag = """
<select name="percent">
<option VALUE="-">-</option>
<option VALUE="0">0%</option>
<option VALUE="10">10%</option>
<option VALUE="20">20%</option>
<option VALUE="30">30%</option>
<option VALUE="40">40%</option>
<option VALUE="50">50%</option>
<option VALUE="60">60%</option>
<option VALUE="70">70%</option>
<option VALUE="80">80%</option>
<option VALUE="90">90%</option>
<option VALUE="100">100%</option>
</select>"""
return tag
When the values are entered, my program stores them into a database.
Everything worked well, but now I have been asked to retain the values
selected in the drop down boxes. This means that when I open the web page, the
drop down boxes should display the recent values entered. I'm not sure how to
do it, and I'm really hoping that someone can point me to the right direction.
Thanks,
Patty
More information about the Tutor
mailing list