HTML Forms;
What is it?
- A form is really 3 things (i) fields that collect information (ii) instructions on where to send the data and (iii) and a button
- There are several types of form inputs listed below
- Text, Hidden, Checkbox, Radial, TextArea, Dropdown menu, Date Selection, etc.
- The instructions on where to send it are next
- Once the infromation is collected you will need to send the data somewhere, to do that you need an additional script which we'll include.
- Lastly, you'll need a button in order to execute the instruction.
Syntax:
- Form Tags: <Form> and </form>
- Input Tags : <input type='The type of input field you want' >
- Button Tag: <button> or <input type='button' value='Submit'>
- Color Coding is for formatting only and does not reflect different languages
Basic Form Example :
<form action='transmitmydata.html' method='post' >
<input type='text' placeholder='Enter Phone Number Here' name='phone' >
<input type='button' value='Submit'>
</form>
|
What's happening in the script above?
- We've got a form with 1 text input, and 1 submit button
- The form has two additional elements "action='transmitmydata.html" and "method='post'"
- The action element is where the data is going to be sent when someone clicks the button
- The method can either be Post or Get ("post" passes the information invisibly, "Get" passes the information visibly in the browser)
- When a user clicks the button, the form has been instructed to send the data in the text box which we've named "phone" to transmitmydata.html
- transmitmydata.html will need read that information and do something with it, like send an email, text message or store the information in a database.
-
Example Output:
See also; HTML Form
See also; HTML Buttons
See also; HTML Iframe