I want get value of parameter form def:a() to def:b() and return to html file. How can I pass value from def to def in differrent path in python flask?
@app.route('/a',methods=['GET','POST'])
def a():
if request.method == 'POST':
text_a = request.form.get('text')
return render_template('index.html')
AND
@app.route('/b',methods=['GET','POST'])
def b():
if request.method == 'POST':
return render_template('index.html',text = text_a )
return render_template('index.html' )
PS> in path /a I want to input text and submit then get value of /a to /b
HTML file
<form method="POST" action= "/a" >
<input type="text" name="text">
<input class="btn btn-primary" type="submit" value="submit">
</form>
{{text}}
Thank you for help.