Passing a variable from a form input to a flask URL
<p>I have a dummy project in Flask, which consists in a web form, where you fill in 3 cities, which are then printed upon submition.
This is my  <strong>init</strong>.py file:</p>

<pre><code>@app.route('/average_temperatures/&lt;city1&gt;/&lt;city2&gt;/&lt;city3&gt;', methods=['POST', 'GET'])
def results_temperature(city1, city2, city3):
    return "The cities are: {}, {}, {}".format(city1, city2, city3)
</code></pre>

<p>The function works, but I am unable to pass the variables from the form straight into the function, as parameters.</p>

<p><strong>edit</strong>:</p>

<p>My goal is to have the city variables as part of the URL in the clean form of /city1/city2/city3.</p>

<p>This is the form:</p>

<pre><code>&lt;div class="input-group"&gt;
&lt;form action="{{ url_for('results_temperature', city1=city1, city2=city2, city3=city3) }}" method="POST"&gt;
  &lt;input type="text" class="form-control" placeholder="City 1" name="city1"&gt;&lt;/input&gt;
  &lt;input type="text" class="form-control" placeholder="City 2" name="city2"&gt;&lt;/input&gt;
  &lt;input type="text" class="form-control" placeholder="City 3" name="city3"&gt;&lt;/input&gt;
&lt;div class="row" style="margin-bottom: 20px;"&gt;&lt;/div&gt;
</code></pre>

<p>Filling out the form results in a URL</p>

<blockquote>
  <p><a href="http://example.com/average_temperatures///" rel="nofollow noreferrer">http://example.com/average_temperatures///</a></p>
</blockquote>

<p>So I evidently fail to pass the form fields in the form action part.
Any hits are appreciated, cheers.</p>