title: Flask Passing Arguments From One Html page to another
body: <p>I am new to flask,HTML,Jinja and i am having trouble passing values from one template to another. Ive looked over many other pages on SO and nobody had quite the same issue. I have a page with a drop down select menu and a submit button which redirects the user once they've made their choice. My issue is that I do not know how to pass that choice to the form on the next page. The following is my HTML form code: </p>
  
  <pre><code> &lt;form method="POST" action="search"&gt;
              &lt;div class="form-group" align="center"&gt;
                   &lt;select class="vertical-menu"&gt;
                      {% for friend in strFriendList %}
                          &lt;option name="friendToPay" value="{{ friend }}"&gt;{{ friend }}&lt;/option&gt;
                      {% endfor %}
                  &lt;/select&gt;
  
                  &lt;a href="{{ url_for('payment') }}"  class="btn-primary"&gt; Submit&lt;/a&gt;
              &lt;/div&gt;
   &lt;/form&gt;
  </code></pre>
  
  <p>And the following are my search and payment functions:</p>
  
  <pre><code>    @app.route("/search")
  def search():
    if "email" not in session:
      return redirect(url_for("login"))
    else:
      friendslist1 = Friendship.query.filter_by(username=session["username"]).all()
      friendslist2 = Friendship.query.filter_by(friendUserName=session["username"])
      strFriendList = [""]
      for friend in friendslist1:
        strFriendList.append(friend.friendUserName)
      for friend in friendslist2:
        strFriendList.append(str(friend.username))
      form = SelectFriendForm()
      return render_template("search.html",strFriendList=strFriendList,form=form)
  
  @app.route("/payment",methods=['GET', 'POST'])
  def payment(personToPay):
      form = PaymentForm()
      if request.method == "POST":
          if form.validate() == False:
              return render_template("payment.html", form=form)
          else:
              return render_template("search.html")
          # else:
          #     # Query the database and deposit the amount and subtract from giver
  
      return render_template("payment.html")
  </code></pre>
  
  <p>I want to get the friend selected in the search function sent to the payment function. Any help would be greatly appreciated, Thank You!</p>