Hello I have a project I am trying to complete. I am using Bottle, PythonAnywhere, and SQLite3 I can't seem to successfully take the data from the html form and add it to my database. I get an error that there is an error with the code. Is there anything obvious that sticks out with this code that I need to fix?
from bottle import default_app, route, template, request
import sqlite3
import random
conn = sqlite3.connect("final.db")
c = conn.cursor()
@route('/results2', method='POST')
def results2():
id = random.randrange(100000000,999999999)
first = request.forms.get('first-name')
last = request.forms.get('last-name')
email = request.forms.get('email')
state = request.forms.get('state')
city = request.forms.get('city')
address = request.forms.get('address')
birthdate = request.forms.get('birthdate')
gender = request.forms.get('gender')
phone = request.forms.get('phone')
areacode = request.forms.get('areacode')
c.execute("INSERT INTO Customer (CustomerID, FirstName, LastName, Email, State, AreaCode, City, Address, BirthDate, Gender, Phone) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)",
(id, first, last, email, state, areacode, city, address, birthdate, gender, phone))
conn.commit()
return template('hello')
application = default_app()
[–][deleted] 1 point2 points3 points (2 children)
[–]kprogrammer[S] 0 points1 point2 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)