Forms Flashcards
What attributes are required in a form element?
action, method, and id
action attribute
its value is the URL for the page on the server that will receieve the information in the form when it is submitted
method attribute
- get method
- the values from the form are added to the end of the URL
- ideal for:
- short forms (such as search boxes)
- when you are just retrieving data from the web server
- post method
- the values are send in what are known as HTTP headers
- ideal if your form:
- allows users to upload a file
- is very long
- contains sensitive data (e.g. passwords)
- adds information to, or deletes information from, a database
input name attribute
- the server needs to know what has been entered as the username and what has been given as the password
- therefore, each fomr control requires a name attribute
- the value of this attribute identifies the form control and is sent along with the information they enter to the server
text input code
(input type=”text” name=”” /)
password input code
(input type=”password” name=”” /)
textarea code
(textarea name=”“)Some Text(/textarea)
radio input code
(input type=”radio” name=”” /)
checkbox input code
(input type=”checkbox” name=”” /)
drop drown list code
(select name=””)
(option value=”“)Option 1(/option)
(option value=”“)Option 2(/option)
(/select)
file input box code
(input type=”file” name=”” /)
submit button code
(input type=”submit” name=”” value=”Submit” /)
image button
(input type=”image” src=”” /)
button code
(button)(img src=”” alt=”” /)Text(/button)
labelling form controls code
(label)Text(input type=”” name=”” /)(/label)