flask web redirect and variable name

24 views Asked by At

okay i created a 2 functions while working with flask i set a variable in the first one then expect to output it in the second function using an html file an {{var_name}} but it doesn't output anything it only works if i return it without using the render_template function

@app.route('/showinfo', methods=['POST', 'GET'])
def showinfo():
    if request.method == 'POST':
        userId = request.form['userid']
        return redirect(url_for('user', usr=userId))
    else:      
        return render_template('showinfo.html')

@app.route('/<usr>')
def user(usr):
    return render_template('showdata.html')

when it redirects to the user function it outputs nothing please help

0

There are 0 answers