Python Flask Basics Character Builder Cookies

Guled Ahmed
Guled Ahmed
12,806 Points

Where are the key's coming from?

I get how the values arise, but where are the keys for the dictionary being grabbed from? Is it from the 'name' attribute in an input tag, or other attributes associated with objects in a form?

1 Answer

Yes, it comes from the name attribute of an input tag. So submitting a form such as:

<form action="/save" method="POST">
  <label for="name">Name:</label>
  <input name="name" type="text">
  <input type="submit" value="submit">

Will send a request with the "name" key associated with whatever value you put into the input field.