Forms
Forms require the following attributes:
action: tells where to send the form:https://wp.zybooks.com/form-viewer.php can be used for testing form submission.method: tells what method to use to send form -method='post'ormethod='get'post: sends data in the body of the request, not visible in the URL (most common)get: sends data in the URL, visible to users
enctype='multipart/form-data': only if the form requires file uploads- Attribute
nameis used to identify the input on the backend - e.g.,name='firstName'
<form action='submit.html' method='post'>
<label for='name'>Name:</label>
<input type='text' id='name' name='name' required /><br>
<input type='submit' value='Submit' />
</form>Input Types
<input type='' id='inputId'>: possible types: text, email, tel, file, submit, radio, checkbox, number, date<label for='inputId'>: label for the<input>; links the label to input's id<fieldset>: container element to group related inputs
Input Attributes
- name
- id
- value
- required
- autofocus
- max/min/step