#!/usr/bin/env python
print "Content-type: text/html"
print
import cgi
def main():
form = cgi.FieldStorage()
if form.has_key("firstname"):
print "<h1>Hello", form["firstname"].value,",",form["lastname"].value, "</h1>"
else:
print "<h1>Error! Please enter first name.</h1>"
now my problem is i dont know how to add this to my simple mysql database, I know how to open the connection, cursors, and send commands via python but my problem is incorporating the value that i have got from the html input and sending it to mysql...
sql = """INSERT INTO EMPLOYEE(FIRST_NAME, LAST_NAME) VALUES (************)"""
would i put the form.["firstname"].value in the VALUES section...or do i have to do something else...


Sign In
Create Account

Back to top









