7

I am relatively new to Python so please excuse any naive questions.

I have a home page with 2 inputs, one for a "product" and one for an "email." When a user clicks submit they should be sent to "/success" where it will say: You have requested "product" You will be notified at "email"

I am trying to figure out the best way to pass the "product" and "email" values through the redirect into my "/success" template. I am using webapp2 framework and jinja within Google App Enginge.

Thanks

Nic Meiring
  • 882
  • 5
  • 16
  • 33

2 Answers2

16

When you do your redirect, include your email and product variables in the redirect. In Google appp engine, using webapp2, your current redirect probably looks like:

self.redirect('/sucess')

Instead, you can add the variables in the URL as follows:

self.redirect('/success?email=' + email + '&product=' + product)

The above URL would look like '/success?email=this@email.com&product=this_product' after concatenating the values.

The handler for /success could then get those values with:

email = self.request.get('email')
product = self.request.get('product')
Aaron Hampton
  • 884
  • 8
  • 26
1

The easiest way is to use HTML forms, the POST request for submitting the form should include the values on the submit.

dragonx
  • 14,963
  • 27
  • 44