Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

flask read form data

from flask import Flask, request
app = Flask(__name__)

@app.route('/', methods=['GET', 'POST'])
def index():
    data = request.form['input_name']  # pass the form field name as key
    ...
Comment

flask get data from html form

from flask import Flask,url_for,request
''' html form:
<form action="{{ url_for('posted')}}" method="post">
     <input id="post" placeholder="enter post" type="text" name="post">
     <button type="submit">submit</button>
 </form>
'''
@app.route('/posted', methods=['POST'])
def posted():
  data = request.form['post']
  return '<h1>'+data+'</h1>'
Comment

PREVIOUS NEXT
Code Example
Python :: how to set default user group in django 
Python :: python sqlite insert 
Python :: channel lock command in discord.py 
Python :: ternary operator python 
Python :: play mp3 file python 
Python :: pyautogui color 
Python :: remove all whitespace from string python 
Python :: model o weight 
Python :: runtime.txt heroku python 
Python :: sum of number digits python 
Python :: python yaml to dict 
Python :: check tf verison 
Python :: button size tkinter 
Python :: python copy an object 
Python :: python numpy array delete multiple columns 
Python :: random id python 
Python :: how to print python 
Python :: isidentifier method in python 
Python :: np deep copy matrix 
Python :: module installed but not found python 
Python :: flatten a 2d list 
Python :: append one row to pandas dataframe 
Python :: padnas drop column 
Python :: webbrowser python 
Python :: python date iso 8601 
Python :: python aws s3 client 
Python :: python pandas replace not working 
Python :: plotting two columns of a dataframe in python 
Python :: numpy item size 
Python :: python create list from range 
ADD CONTENT
Topic
Content
Source link
Name
9+1 =