hey guys im trying to get my html and python cgi script working together to show the users selections of the checkboxes of bulbs and add them up aswell plus the method they wana pay once they pretty the submit form button..
here is my html code:
<html>
<body>
<form action="cgi-bin/cost.py" method="POST">
<p>Enter Name: <input name="name" type="text"/></p>
<p>4 x 100-watt light bulbs for $2.39:<input name="bulb1" type="checkbox" value="2.39"/></p>
<p>8 x 100-watt light bulbs for $4.29:<input name="bulb2" type="checkbox" value="4.29"/></p>
<p>4 x 100-watt long-life light bulbs for $3.95:<input name="bulb3" type="checkbox" value="3.95"/></p>
<p>8 x 100-watt long-life light bulbs for $7.49:<input name="bulb4" type="checkbox" value="7.49"/></p>
<p>
Visa:<input type="radio" name="card" value="Visa"/>
MasterCharge:<input type="radio" name="card" value="MasterCharge"/>
Discover:<input type="radio" name="card" value="Discover"/>
</p>
<input type="submit" name="Submit" value="Submit Form"/>
<input type="reset"/>
</form>
</body>
</html>
here is my python cgi code:
#!/apache2triad/python/bin/python.exe
import cgi
import sys
import httplib
import cgitb; cgitb.enable()
def header():
print "Content-type: text/html"
print
main()
def main():
print "<html><head><title>Python Form</title></head><body>"
form = cgi.FieldStorage()
keyList = form.keys()
for key in keyList:
if key == form["bulb1"].value:
print form["bulb1"].value + "<br>"
print "</body></html>"
header()
thank u