#!"C:\Python33\python.exe" import mysql.connector from tkinter import * # Import modules for CGI handling import cgi, cgitb # Create instance of FieldStorage form = cgi.FieldStorage() # Get data from fields first_name = form.getvalue('first_name'); last_name = form.getvalue('last_name'); print ("Content-type:text/html\r\n\r\n"); print (""); print (""); print ("Hello - Second CGI Program"); print (""); print (""); print ("

Hello %s %s

" % (first_name, last_name)); print("Go Back"); print (""); print (""); db=mysql.connector.connect(host='localhost',port='3306',database='python_data', user='root',password='') s = "INSERT INTO cgi_member (fname, lname) VALUES ('%s', '%s');" %(first_name, last_name) cursor = db.cursor() cursor.execute(s) cursor.close() db.commit() db.close()