title: How to get form data from input as variable in Flask?
body: <p>I'm working on a simple UI to start and stop games by ID. The basic HTML I have written is as follows (<code>game_id</code> is populated by JS):</p>
  
  <pre><code>  &lt;div align="center" class="top"&gt;
      &lt;div align="left" class="game-id-input"&gt;
        Game ID: &lt;input type="text" name="game_id" id="game_id"&gt;
      &lt;/div&gt;
  
      &lt;div align="right" class="buttons"&gt;
        &lt;form action="{{ url_for('start_game', game_id=game_id) }}" method="get"&gt;
          &lt;input type="submit" name="start" value="Start game" class="btn btn-success"&gt;&lt;/input&gt;
        &lt;/form&gt;
        &lt;form action="{{ url_for('end_game', game_id=game_id) }}" method="get"&gt;
          &lt;input type="submit" name="end" value="End game" class="btn btn-danger"&gt;&lt;/input&gt;
        &lt;/form&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  </code></pre>
  
  <p>which looks like</p>
  
  <p><a href="https://i.stack.imgur.com/IaCg1.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/IaCg1.png" alt="input_and_buttons"></a></p>
  
  <p>I also have Flask route functions defined for each of the forms:</p>
  
  <pre><code>@app.route("/start_game/&lt;game_id&gt;")
  def start_game(game_id):
      # ...
  
  @app.route("/end_game/&lt;game_id&gt;")
  def end_game(game_id):
      # ...
  </code></pre>
  
  <p>In my forms, how can I make <code>game_id</code> correspond to the <code>game_id</code> from <code>#game_id</code>?</p>
  
  <p>Currently when I submit start and end games, I get a File Not Found error because it's just appending the literal <code>&lt;game_id&gt;</code> to the route.</p>
  
  <p>I'm new to web development. This should be trivial, but I don't know what to search for. Sorry in advance for such a simple question.</p>