title: Assign a variable from HTML input to Python/Flask
body: <p>I have an app that uses a variable to to locate a row in a <strong>pandas</strong> dataframe. I want the user to use the <code>input[type=range]</code> in html to select a year that will be used as the variable x. </p>
  
  <p>Here is my python file:</p>
  
  <pre class="lang-py prettyprint-override"><code>from flask import Flask, render_template, request
  
  app = Flask(__name__)
  
  x = '2005'
  mask = (df['start'] &lt; x) &amp; (df['end'] &gt; x) 
  output = df.loc[mask]
  
  @app.route("/")
  def home():
      return render_template("index.html", output=output)
  </code></pre>
  
  <p>Here is my html form:</p>
  
  <pre class="lang-html prettyprint-override"><code>&lt;form name="myform" method="POST"&gt;
    &lt;input type="range" name="yearInputName" id="yearInputId" value="1980" min="1880" max="2010"&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>How do I assign the variable x to the output of the form? So when a user selects the year 2007 for example, in the python file the variable x will change to '2007'?</p>