0

I have a simple form that I've created in flask and i am trying to get the forms data into my app.py but I'm currently unsure what im doing wrong as i am receiving no information back when i hit the search button.

Here is my code;

@app.route('/', methods=['POST', 'GET'])
def main():
    if request.method == 'POST':
        print("post working")
        _radius = request.form['radius']
        _postcode = request.form['postcode']
        print(_radius, _postcode) # This does not print so the POST method is not working
        return render_template("Tails.html", LocationData = _searchfunctionality(_radius, _postcode))
    else:
        print("default working")
        return render_template('Tails.html', LocationData = _longitudelatitude())

HTML;

<form action="/" method="POST">
   <input type="text" name = "radius" placeholder="Radius">
   <input type="text" name = "postcode" placeholder="Postcode">
   <button type="button">Search stores</button>
</form>

Any help/suggestion on this would be appreciated.

0 Answers0