title: Handling POST request Flask
body: <p>I am trying to pass data from my website's login page as a POST request to Flask. However, Flask fails to obtain any data. Here's a code snippet of my test.py file that runs the Flask app. I realised that the code isn't entering the method itself.Can anyone help me understand where am I going wrong?</p>
  
  <pre><code>@app.route('/', methods=['POST'])
  def my_form_post():
      text = request.form['text']
      processed_text = text.upper()
      print "Processed text is..."
      print processed_text
      return processed_text
  </code></pre>
  
  <p>Here's the snippet of my login form:</p>
  
  <pre><code>div class="modal fade" id="direct-login-form" tabindex="-1" role="dialog" aria-labelledby="direct-login-form-label" aria-hidden="true"&gt;
        &lt;div class="vertical-alignment-helper"&gt;
            &lt;div class="modal-dialog vertical-align-center"&gt;
                &lt;div class="modal-content"&gt;
                    &lt;div class="modal-header"&gt;
                        &lt;button type="button" class="close" data-dismiss="modal"&gt;&lt;span aria-hidden="true"&gt;&amp;times;&lt;/span&gt;&lt;span class="sr-only"&gt;Close&lt;/span&gt;
  
                        &lt;/button&gt;
                         &lt;h4 class="modal-title" id="direct-login-form-label"&gt;Login&lt;/h4&gt;
  
                    &lt;/div&gt;
                    &lt;div class="modal-body"&gt;
                      &lt;div class="wrap-login-form wrap-reviews"&gt;
                        &lt;form id="direct-login" form action="." method="POST" class="form-horizontal"&gt;
                          &lt;div class="form-group"&gt;
                            &lt;label class="col-sm-3" for="direct_username"&gt;Username&lt;/label&gt;
                            &lt;div class="col-sm-9"&gt;
                              &lt;input type="text" name="text" class="form-control" id="direct_username" placeholder="Username"&gt;
                            &lt;/div&gt;
                          &lt;/div&gt;
                          &lt;div class="form-group"&gt;
                            &lt;label class="col-sm-3" for="direct_password"&gt;Password&lt;/label&gt;
                            &lt;div class="col-sm-9"&gt;
                              &lt;input type="password" class="form-control" id="direct_password" placeholder="Password"&gt;
                            &lt;/div&gt;
                          &lt;/div&gt;
                          &lt;div class="wrap-slidecheck clearfix"&gt;
                            &lt;div class="col-sm-3"&gt;&lt;/div&gt;
                            &lt;div class="col-sm-9"&gt;
                              &lt;div class="slidecheck"&gt;
                                &lt;input type="checkbox" id="direct_remember_me" name="check" /&gt;
                                &lt;label for="direct_remember_me"&gt;&lt;/label&gt;
                              &lt;/div&gt;
                              &lt;span&gt;Remember me&lt;/span&gt;
                            &lt;/div&gt;
                          &lt;/div&gt;
                          &lt;div class="form-group"&gt;
                            &lt;label class="col-sm-3"&gt;&lt;/label&gt;
                            &lt;div class="col-sm-9"&gt;
                              &lt;button type="submit" name="my-form" class="btn btn-default" value="Send"&gt;Submit&lt;/button&gt;
                            &lt;/div&gt;
                          &lt;/div&gt;
                          &lt;div class="form-group"&gt;
                            &lt;label class="col-sm-3"&gt;&lt;/label&gt;
                            &lt;div class="col-sm-9"&gt;
                              &lt;p class="help-block"&gt;&lt;a href="../../vxeg/indexc2b6.html?action=lostpassword"&gt;Lost your password?&lt;/a&gt;&lt;span&gt; or &lt;/span&gt;&lt;a href="../../membership-account/index.html"&gt;Register an Account&lt;/a&gt;&lt;/p&gt;
                            &lt;/div&gt;
                          &lt;/div&gt;
                          &lt;input type="hidden" id="direct_security" name="direct_security" value="f0abedaf74" /&gt;&lt;input type="hidden" name="_wp_http_referer" value="/directory-category/coffee-lounge/" /&gt;                      &lt;/form&gt;
                      &lt;/div&gt;
                    &lt;/div&gt;
                &lt;/div&gt;
            &lt;/div&gt;
        &lt;/div&gt;
    &lt;/div&gt;
  </code></pre>