Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

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>'
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #flask #data #html #form
ADD COMMENT
Topic
Name
3+7 =