[Tutor] (no subject)

Белякова Анастасия nasbelyakova at gmail.com
Sun Apr 2 05:23:47 EDT 2017


Hi there! How are you?
I need an advise.

I need to get values from html form, but form.getvalues['query'] returns
None. Incorporated in function and not. The aim is to get the user input
after filling form and clicking submit button. Here is a piece of code:

form = cgi.FieldStorage()

A = ['Course_Name', 'Gender', 'Phone_No', 'Residential_Address',
'Student_LastName',
     'Student_FirstName', 'Password']
data_values = {}for i in dict(form).keys():
    if i in A:
        data_values[(str(i))] = "'" + dict(form)[str(i)].value + "'"



course, gender, phone, adress, last_name, first_name, password=
[data_values[i] for i in sorted(data_values.keys())]

And this is a fragment of html:

<form action="/cgi-bin/Hello.py" name="StudentRegistrationForm"
method="post" onsubmit="return ValidateForm()">

<input type="text" name="Student_LastName" size="40" maxlength="30"
style="font-weight: 700"/></font></td>

What could be the reason? What can I do?


More information about the Tutor mailing list