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 :: rename pandas columns with list of new names 
Python :: writerows to existing csv python 
Python :: python except print error type 
Python :: python pandas give column names 
Python :: input numpy array 
Python :: find duplicated entries present in a list 
Python :: strftime 
Python :: python argparse file argument 
Python :: query with condition django 
Python :: how to create dictionary between two columns in python 
Python :: python split every character in string 
Python :: one line if statement without else 
Python :: spam python 
Python :: tab of nbextensions not showing in jupyter notebook 
Python :: sum group by pandas and create new column 
Python :: grouped bar chart matplotlib 
Python :: create an empty list of lists in python 
Python :: django collectstatic 
Python :: python move cursor to previous line 
Python :: run python.py file 
Python :: see attributes of object python 
Python :: Python3 boto3 put and put_object to s3 
Python :: how to count how many cameras you have with python 
Python :: types of dict comprehension 
Python :: dataframe color cells 
Python :: how to do a mac vendor lookup in python 
Python :: is python oop 
Python :: turn list in to word python 
Python :: creating empty set and append python 
Python :: python pow 
ADD CONTENT
Topic
Content
Source link
Name
1+6 =