Lab Lec10
Lab Lec10
Forms
An HTML form is used to collect user input.
The user input is most often sent to a server
for processing.
The HTML <form> element is used to create
an HTML form for user input.
The <form> element is a container for
different types of input elements, such as: text
fields, checkboxes, radio buttons, submit
buttons, etc.
The <input> Element
ost">
Form Elements
The HTML <form> element can contain one or more of the
following form elements:
<input>
<label>
<select>
<textarea>
<button>
<fieldset>
<legend>
<datalist>
<output>
<option>
<optgroup>
<html>
<body>
<form>
<label for="fname">First name:</label>
<input type="text" id="fname" name="fname
">
<label for="cars">Choose a car:</label>
<select id="cars" name="cars">
<option value="volvo">Volvo</option>
<option value="saab">Saab</option>
<option value="fiat">Fiat</option>
<option value="audi">Audi</option>
</select>
<option value="fiat" selected>Fiat</option>
<textarea name="message" rows="10" cols="
30">
The cat was playing in the garden.
</textarea>
<button type="button" onclick="alert('Hello
World!')">Click Me!</button>
</form>
</body>
</html>
Thank you