librelist archives

« back to archive

url with searched word

url with searched word

From:
Mihai Sandu
Date:
2012-07-23 @ 13:05
Hi everyone, I want to ask how to make my urls to include the worh that I
searched. Something like this: http://localhost/filter?test

 My code:
@app.route('/filter', methods=['POST', 'GET'])
def filter():
        if request.method == 'POST':
            if str(request.form['search_string']) <> '':
                api.queryMessage(request.form['search_string'])
       return render_template('main.html', search_string=search_string)

And my template, main.html:
<form name="filters" action="{{ url_for('filter') }}" method=post
id="filters">
   <div style="position: absolute; top:100px; left:300px">
                    <p>Search string: <input type=text size=80 title="Match
all of the words" name=search_string value="{{search_string}}"></p>
                    <input type=submit value=Filter/Search
onclick=loopSelected();>
                    <input type="hidden" name="chosen" id="chosen"
value="{{chosen}}" />
   </div>
</form>