title: Taking data from drop-down menu using flask
body: <p>I'm completely new to flask, and really am completely lost with how to approach this. I've looked into other SO questions but I can't seem to get this working regardless.  </p>
  
  <p>I have a form as such:  </p>
  
  <pre><code>&lt;form class="teamSelection" method="POST" action="/submitted"&gt;  
     &lt;select class="teamForm" id="teamDropdownSelector" type="text" name="teamDropdown" placeholder="Select A Team"&gt;
          &lt;option disabled selected&gt;Select a game&lt;/option&gt;
          &lt;option id="WatfordVSManchester Utd" value=""&gt;Watford VS Manchester Utd&lt;/option&gt;
     &lt;/select&gt;
     &lt;input class="btn" type="submit" value="submit"&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>and my flask as so:  </p>
  
  <pre><code>from flask import Flask
  app = Flask(__name__)
  
  @app.route("/submitted")
  def hello():
      return "hello world"
  </code></pre>
  
  <p>The goal is to take the content of the selected/submitted dropdown item, pass this to the flask file where I then use the team names to scrape information about the match. However at the moment I can't even seem to get the POST of the form to work and am at a complete loss. I appreciate this is a pretty vague and open-ended question, but I seriously don't know how else to figure this out.  </p>
  
  <p>Should I instead use jquery to detect when the dropdown has changed and use AJAX to send a POST to somehow call the script and pass the values into it?  </p>
  
  <p>Any help would be greatly appreciated.</p>
  
  <hr>
  
  <p><strong>EDIT</strong><br>
  I thought I put this in the original post, but must have forgot.<br>
  I am currently running an apache localhost server, and am working with flask via pycharm. All I've done at the moment is install the flask package in pycharm, and haven't set any of it up like I've seen in some tutorials do when running from the command line. I assumed this step wasn't necessary, as I already have a server up and running with apache?<br>
  When it comes to backend stuff like this I really have no idea, so apologies if that's a stupid assumption.  </p>
  
  <p>I've changed the flask to:  </p>
  
  <pre><code>from flask import Flask
  app = Flask(__name__)
  
  @app.route("/submitted", methods=['POST'])
  def hello():
      with open("newTest.csv", mode="w+") as file:
          fileWriter = csv.writer(file)
          fileWriter.writerow(['Time', 'HomeTeam', 'AwayTeam'])
      file.close()
  </code></pre>
  
  <p>The reason being as I can see if this script is actually being called, if it is it will make a new csv file called newTest. After running the webpage and submitting no new csv file appears, so this script isn't being run, meaning it's likely due to me not configuring flask correctly?/The assumption that apache was enough was incorrect?</p>