title: Pass selected option value from select tag in python flask
body: <p>I have a user registration form which has a select tag. I want the value from the selected option to be assigned to a variable(the code is shown below).</p>
  
  <p><b>registration.html</b></p>
  
  <pre><code>&lt;form method="POST" action="/register"&gt;
              &lt;div class="form-group"&gt;
                  {{render_field(form.name, class_="form-control", placeholder="Name")}}
              &lt;/div&gt;
              &lt;div class="form-group"&gt;
                  {{render_field(form.email, class_="form-control",placeholder="Email")}}
              &lt;/div&gt;
              &lt;div class="form-group"&gt;
                  {{render_field(form.username, class_="form-control", placeholder="Username")}}
              &lt;/div&gt;
              &lt;div class="form-group"&gt;
                  {{render_field(form.password, class_="form-control", placeholder="Password")}}
              &lt;/div&gt;
              &lt;div class="form-group"&gt;
                  {{render_field(form.confirm, class_="form-control", placeholder="Re-enter Password")}}
              &lt;/div&gt;
               &lt;div class="form-group"&gt;
                   &lt;p&gt;I prefer to : &lt;/p&gt;
                   &lt;select id= "studenttype" name="studenttype"&gt;
                      &lt;input type="radio" name="Theorist" value="Theorist"&gt;&lt;span&gt;Read lecture notes&lt;/span&gt;&lt;br/&gt;
                      &lt;input type="radio" name="Theorist" value="Activist"&gt;&lt;span&gt;Watch videos&lt;/span&gt;
                   &lt;/select&gt;
               &lt;/div&gt;
              &lt;input type="submit" class="btn btn-success" value="Submit"&gt;
              &lt;p&gt;Register as &lt;a href="/register_instructor"&gt;Instructor&lt;/a&gt; &lt;/p&gt;
          &lt;/form&gt;
  </code></pre>
  
  <p>I have used the following code to assign the selected option value to the variable <code>learning_style</code>. </p>
  
  <p><b>app.py</b></p>
  
  <pre><code>@app.route('/register', methods=['GET', 'POST'])
  def register():
      learning_style = request.form.get("studenttype")
      form = RegisterForm(request.form)
      if request.method == "POST" and form.validate():
          name = form.name.data
          email = form.email.data
          username = form.username.data
          password = form.password.data
          user_type = 'student'
          print(learning_style)
  
          ...........
  
          flash('You are now registered', 'success')
          redirect(url_for('index'))
      return render_template('register.html', form=form)
  </code></pre>
  
  <p>But this doesn't seem to work. Any help is much appreciated. Thanks.</p>