title: Passing variable through response object in Flask framework
body: <p>I need to pass a variable along with response object while complete signup process and display the success message on the same page. I tried so many ways but I couldn't find any idea how to do that. Please look at this scenario and help me out.  </p>
  
  <pre><code>@app.route('/signup', methods=['POST', 'GET'])
      def signup():
          message = ''
          email = ''
          password = ''
          resp = app.make_response(render_template('signup.html'))
          if request.method == 'POST':
              import datetime
              email = request.form['emailInput']
              password = request.form['pswdInput']
  
              if len(password) &lt; 3:
                  message = Markup("&lt;p style='color:red;'&gt; Password Length Should Be More Than 3 Character &lt;/p&gt; ")
                  return render_template('signup.html', message = message)
  
              expire_date = datetime.datetime.now()
              expire_date = expire_date + datetime.timedelta(hours=1)
              resp.set_cookie('userEmail', email, expires=expire_date)
              resp.set_cookie('userPassword', password, expires=expire_date)
  
              message = Markup("&lt;h1&gt; Registration successfull! &lt;/h1&gt;")
              resp.headers.set('message', message)
              return resp
  
          return render_template('signup.html', message = message)
  </code></pre>
  
  <p>HTML :</p>
  
  <pre><code>&lt;div class="container"&gt;
  &lt;a href = "{{url_for('home')}}"&gt; Home &lt;/a&gt;
      &lt;form id="signup" method="POST" action="{{url_for('signup')}}"&gt;
  
          &lt;div class="header"&gt;
  
              &lt;h3&gt;Sign Up&lt;/h3&gt;
  
              &lt;p&gt;You want to fill out this form&lt;/p&gt;
  
          &lt;/div&gt;
  
          &lt;div class="sep"&gt;&lt;/div&gt;
  
          &lt;div class=""&gt;
  
              &lt;input type="email" name="emailInput" placeholder="e-mail" autofocus /&gt;
  
              &lt;input type="password" name="pswdInput" placeholder="Password" /&gt;
  
              &lt;div class=""&gt;
                  &lt;input name="joinCheck" name="joinCheck" value="1" type="checkbox" /&gt;&lt;label class="terms"&gt;I accept the terms of use&lt;/label&gt;
              &lt;/div&gt;
  
              &lt;input type="submit" id="submitBtn" value="Submit"&gt;SIGN UP FOR INVITE NOW&lt;/a&gt;
  
          &lt;/div&gt;
          &lt;div&gt;
              {{message}}
          &lt;/div&gt;
  
      &lt;/form&gt;
  
  &lt;/div&gt;
  </code></pre>