I know this is simple but I couldn't succeed. I add data to database but I click the button my page is going to another page. Because I write redirect line. But if I don't write my process doesn't work. My codes are these:
main.py
class AddWord(webapp2.RequestHandler):
def post(self):
word = Word()
word.name = self.request.get("content")
word.put()
query_params = {'you added': word.name }
self.redirect('/?' + urllib.urlencode(query_params))
application = webapp2.WSGIApplication([
('/', MainPage),
('/add', AddWord),
], debug=True)
my index.html
<body>
<form action="/add?" method="post">
<div><textarea name="content" rows="3" cols="60"></textarea></div>
<div><input type="submit" value="Send Word"></div>
</form>
When I write my word to textarea and click to button I don't want to go anywhere, but I couldn't handle form action parameter and the others. Please can you tell me what I must do? Thanks.