Advertisement
ssoni

survey app.py (359-3)

May 17th, 2022
692
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.63 KB | None | 0 0
  1. from flask import Flask, render_template, request
  2.  
  3. app = Flask(__name__)
  4.  
  5. @app.route("/process_data", methods=['GET', 'POST'])
  6. def process_data():
  7.  
  8.     #get data from form request
  9.     least_fav_class = request.form['lfc']
  10.  
  11.    
  12.     choco = request.form['chocolate']
  13.     straw = request.form['strawberry']
  14.     vanilla = request.form['vanilla']
  15.     lrs = request.form['state']
  16.     favsport = request.form['sport']
  17.     fvg = request.form['videogame']
  18.  
  19.     #save data record into a file
  20.     print(f"c={choco} s={straw} v={vanilla}")
  21.  
  22.     return("test")
  23.  
  24. @app.route("/")
  25. def index():
  26.     return render_template("index.html")
  27.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement