title: Taking HTML input in flask and returning the data
body: <p>I want to take an input from a searchfield from a specific URL and run a function through it on Flask. However I constantly get 405 method not allowed, even though if I only run @app.route("/") the data returns like I want.</p>
  
  <pre><code>@app.route('/searchcountry', methods = ["GET"])
  def single():
      return render_template("singlecountry.html")
  
  @app.route('/searchcountry', methods = ["POST"])
  def singlecountry():
      countrydata = request.form["textfield1"]
      alldata = allfacts(countrydata)
      return render_template("singlecountry.html", alldata = alldata, countrydata = countrydata) 
  
  </code></pre>
  
  <p>Here I try to update the /searchcountry with the data that I want. </p>
  
  <pre><code>&lt;!DOCTYPE html&gt; 
  &lt;html&gt;
      &lt;head&gt;&lt;/head&gt;
      &lt;body&gt;
          &lt;nav&gt;
              &lt;a href="/home"&gt;homepage&lt;/a&gt;
              &lt;a href="/singlecountry"&gt;All data on one country&lt;/a&gt;
              &lt;a href="/comparedcountries"&gt;Compare two countries&lt;/a&gt;
          &lt;/nav&gt;
          &lt;h1&gt;Data about {{countrydata}}&lt;/h1&gt;
          &lt;h4&gt;Data is collected from the WHO:&lt;br&gt;&lt;a href="https://apps.who.int/gho/portal/uhc-cabinet-wrapper-v2.jsp?id=1010501"&gt;Universal Health Coverage&lt;/a&gt;&lt;br&gt; 
              As well as the Happy Planet Index:&lt;br&gt;&lt;a href="http://happyplanetindex.org/"&gt;The Happy Planet Index&lt;/a&gt;&lt;/h4&gt;
  
          &lt;form id="search" name="search" action="." method="POST"&gt;
               &lt;div id="searchfield"&gt;
                  All data on a country:&lt;br&gt;&lt;input type="text"  name="textfield1"&gt;
             &lt;/div&gt;
             &lt;input type="submit"&gt;
          &lt;/form&gt;
  
          &lt;h3&gt;{{countrydata}}&lt;/h3&gt;
          {% for data in alldata %}
           &lt;tr&gt;
          &lt;td&gt;{{data}}&lt;/td&gt;
               &lt;br&gt;
          &lt;/tr&gt;
           {% endfor %}
  
      &lt;/body&gt; 
  
  &lt;/html&gt;
  </code></pre>
  
  <p>My html code. I know the function works.  </p>