Forms Updated Flashcards
How do forms work?
- A users fills in the form.
- The user then submits the form. The name and value of each form control the user selects is sent to the server
- The server processes the submitted info (Possibly it will store this in a database)
- The server sends a message back to the user
How do forms work?
- A users fills in the form.
- The user then submits the form. The name and value of each form control the user selects is sent to the server
- The server processes the submitted info (Possibly it will store this in a database)
- The server sends a message back to the user
What HTTP methods are used to send user information to the server?
GET
POST
How do we add a form to a page?
Looking at the form attributes
id = We use an ID attribute to help identify the form and so we can work with it easily method = This is the http method used to send information to the server action = points to a script to process the submitted form
How do you add a text field to a form?
Use an input tag with the type attribute set to text. It’s an empty element so we don’t have a separate closing tag.
Let’s look at the attributes
name = The name attribute identifies the form element maxlength = restricts how many characters the user can enter
What HTTP methods are used to send user information to the server?
GET
POST
How does the server understand the data is sent by the user?
The data is submitted in name/value pairs. The name comes from the form element, and the value from what the user enters into that element
How do we add a form to a page?
How do you add a text field to a form?
Use an input tag with the type attribute set to text. It’s an empty element so we don’t have a separate closing tag.
Let’s look at the attributes
name = The name attribute identifies the form element maxlength = restricts how many characters the user can enter
How do you add a password field to a form?
Use an input tag with the type attribute set to password. It’s an empty element so we don’t have a separate closing tag.
A password input will mask the characters entered into the field. Generally, they’ll show up as dots.
Let’s look at the attributes
name = The name attribute identifies the form element maxlength = restricts how many characters the user can enter