Forms Flashcards
How do forms works
User fills in the form The name and value of each form control the user selects is sent to the server Server processes info (Possibly stores it in a database) Server sends a message back to the user
How is data sent to the server?
In name/value pairs. Nmae is what type of content it is value the actual content
What’s the syntax for a adding a form?
form action=”process.php” id=”signUp” method=”get”>
action - linked to code to process the page once it’s submitted method - how the data should be sent to the server (HTTP method) e.g. GET, POST id - uniquely identifies the form
When should you use GET and POST methods?
How do you add a text input
``
name - used to identify the data maxlength - control how many characters
How do you add a password input
``
` `
` `
type - using password, masks the characters name - used to identify the data maxlength - control how many characters
How do you add a text area
encode<textarea>Please add comments encode</textarea>
name - used to identify the data Any text included between the tags will initially display in the text box to its active
How do you add a radio button
<input></input>iOS4 <input></input>iOS5 <input></input>iOS6 <input></input>iOS7 <input></input>iOS8
name - used to identify the data value - the value passed to the server checked attribute can be added to element to select it. Only one radio button can be selected
How do you add checkboxes
<input></input>iOS4 <input></input>iOS5 <input></input>iOS6 <input></input>iOS7 <input></input>iOS8
name - used to identify the data value - the value passed to the server checked attribute can be added to element to select it.
How do you add a dropdown list
<label>Device</label>
<select></select>
<option>-- Please Select --</option> <option>iPad</option> <option>iPhone</option> <option>iPad</option> <option>iWatch</option> <option>iCamera</option>
iPod iPhone iPad
name - used to identify the data value - the value passed to the server User can only select one option selected attribute can be added to an option tag
How do I turn a dropdown list to a select box
<label>Device</label>
<select> </select>
<option>-- Please Select --</option> <option>iPad</option> <option>iPhone</option> <option>iPad</option> <option>iWatch</option> <option>iCamera</option>
Giver it a size attribute ` iPod iPhone iPad ` name - used to identify the data value - the value passed to the server User can only select one option selected attribute can be added to an option tag multiple attribute - allows multiple selections
How do you add a file upload
<input></input>
Must be sent as POST Automatically adds a browse button
How do you add a submit button
<input></input>
Cane use a name attribute (doesn’t need to)
How do you add an image button
<input></input>
Use this to add an image for a submit button
How do you add a button
<button> <p> Sign this /</p></button>
<p> </p>
</button>