0

I'm taking HTML form input through a flask server. I have two problems with it, one, it does not hold onto the data that the user enters. Meaning that, at the top of the code the variable is initialized at 3000, and the user enters 1500 when the function is called, but 3000 is still being passed for some reason.

This is my flask application

@app.route('/', methods=["GET", "POST"])
def gfg():
    if request.method == "POST":
        # getting input with name
        set_freq = request.form.get("set_freq") 
        return redirect(request.url)
    return render_template("main_page.html")

main_page.html is the HTML page I have with the form tags in it.

I call 'app.run' in my main function, the user enters 1500, at then that value has to be pushed to another function. A function I'm just calling test, that all it does is print the value of set_freq for right now. Any help would be appreciated.


if __name__ == '__main__':
    app.run()
    test_fun(set_freq)

test_fun just has a print(set_freq) and is passing in set_freq

0 Answers0