how to suse cgi library in python to take input from an html page code example
Example: redirect user based on input with python cgi code
import cgi, cgitb
import pymongo
from pymongo import MongoClient
form = cgi.FieldStorage()
client = MongoClient()
db_mydb = client.mydb
collection_user = db_mydb.user
email = form.getvalue('login-username')
password = form.getvalue('login-password')
existence_query = collection_user.find_one({"_id":email,"password":password})
if(existence_query):
print "Location:http://localhost/mongo/index.html\r\n"
print "Content-type:text/html\r\n\r\n"
else:
print "Location:http://localhost/mongo/index.html\r\n"
print "Content-type:text/html\r\n\r\n"