i am trying to make use of django to retrieve data from my sign up form and pass it into my database in pgadmin 4 as a query. I got error and doesnt know how to go about doing it. This is my code which i tried to use pymysql.

Thanks in advance

def booknow(request):
    c = pymysql.connect(host='localhost',
    cur = c.cursor()
    if request.method == 'POST':
        display_name = request.POST.get['your-name']
        email = request.POST.get['your-email']
        age = request.POST.get['your-age']
        phone_number = request.POST.get['phone-number']
        gender = request.POST.get['your-gender']
        vaccination_status = request.POST.get['your-vaccination']
        password = request.POST.get['your-password']
        insert_query = "INSERT INTO users (display_name, email, age, phone_number, gender, vaccination_status, password) VALUES ('%s','%s','%s','%s','%s','%s','%s');" % (display_name,email,age,phone_number,gender,vaccination_status,password)
        c = connection.cursor()
    return render(request, 'booknow.html')

Sign up form

New contributor
N_ote is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.


Your Answer

N_ote is a new contributor. Be nice, and check out our Code of Conduct.

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.