# Collection of code snippets by Arne Vajhøj 
# (from articles on eksperten.dk / vajhoej.dk written sometime between 2004 and now) 
import cgi
import pymysql

form = cgi.FieldStorage()
f1 = form['f1'].value
f2 = form['f2'].value
con = pymysql.connect(host='localhost',user='root',password='',db='test')
c = con.cursor()
c.execute('INSERT INTO t1(f1,f2) VALUES(%s,%s)', (f1,f2))
c.close()
con.commit()
con.close()
print('Location: http://arne1.vajhoej.dk/cgi-bin/showpy')
print('')
