How to get the value of html select option using p

2019-05-29 13:45发布

I am working on a web application using Google App Engine. I am using Python Runtime Environment. I am also using Jinja2 framework. The problem I have is this: On my html page, I have the following markup inside a form:

 <select name="word" class="span4">
      <option value="authors" selected>Authors</option>
      <option value="blogs">Blogs</option>
      <option value="bloggers">Bloggers</option>
      <option value="ebooks">Ebooks</option>
      <option value="author">Author</option>
      <option value="writers">Writers</option>
      <option value="kindle">Kindle</option>
 </select>

Before switching to using <select option>, I was using <input type="text"..../> and getting the input value inside Python was as simple as :

def post(self):
    word = self.request.get('word')

but now I cannot get the script to work because I cannot access the selected value from the form submitted by the users. Please help because I have looked around and couldn't find anything clear! Thank you and I look forward to your help!

1条回答
登录 后发表回答