Page 152 - DCAP202_Fundamentals of Web Programming
P. 152
Unit 12: HTML Forms
Notes
Example:
<form name=”myForm” action=”http://localhost:8080/abc.html” method=”post”>
<p>Please select every sport that you play.</p>
Soccer: <input type=”checkbox” name=”sports” value=”soccer” /><br />
Football: <input type=”checkbox” name=”sports” value=”football” /><br />
Baseball: <input type=”checkbox” name=”sports” value=”baseball” /><br />
Basketball: <input type=”checkbox” name=”sports” value=”basketball” />
</form>
Self Assessment
Fill in the blanks:
10. ............................ are used when you want to let the visitor select one or more options from
a set of alternatives.
11. If only one option is to be selected at a time you should use ............................
12.6 HTML Radio Buttons
The Radio Button in HTML are type of input form, which allows a user to select any one option
from the alternative options.
!
Caution To achieve this, we must specify the name of radio button properly.
The code enables a user to select one radio button at a time among alternative buttons.
<input type>: The <input> type specify the component type is radio button.
<value>: The <value> specify the output value of input element in html page, when it is clicked.
Did u know? The Output result is sent to the specified form’s action URL.
Example:
<form action=””>
I have a bicycle:
<input type=”radio” name=”vehicle” value=”bicycle”>
I have a bike:
<input type=”radio” name=”vehicle” value=”bike”>
I have a car:
<input type=”radio” name=”vehicle” value=”car”>
</form>
Self Assessment
Fill in the blanks:
12. The Radio Button in HTML are type of ............................ form, which allows a user to select
any one option from the alternative options.
LOVELY PROFESSIONAL UNIVERSITY 145