0% found this document useful (0 votes)
16 views2 pages

HTML Form Fields Part2

The document provides an overview of various HTML form fields including radio buttons, drop-down menus, and submit/reset buttons. It includes examples of HTML code for each type of form field, demonstrating how to implement them in a web form. A full example is also provided, showcasing a complete form with multiple input types.

Uploaded by

achauhan1787
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views2 pages

HTML Form Fields Part2

The document provides an overview of various HTML form fields including radio buttons, drop-down menus, and submit/reset buttons. It includes examples of HTML code for each type of form field, demonstrating how to implement them in a web form. A full example is also provided, showcasing a complete form with multiple input types.

Uploaded by

achauhan1787
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

HTML Form Fields - Part 2

1. Radio Button:

- Allows the user to choose only one option.

- All radio buttons must share the same 'name'.

- HTML Code Example:

<form>

<p>Select your gender:</p>

<input type="radio" name="gender" value="male"> Male<br>

<input type="radio" name="gender" value="female"> Female<br>

<input type="radio" name="gender" value="other"> Other

</form>

2. Drop-down Menu:

- Provides a list of options in a small menu.

- The user can select one option.

- HTML Code Example:

<form>

<label for="country">Choose your country:</label><br>

<select id="country" name="country">

<option value="india">India</option>

<option value="usa">USA</option>

<option value="uk">UK</option>

</select>

</form>

3. Submit and Reset Buttons:

- Submit Button: Sends form data to the server.

- Reset Button: Clears the form fields.

- HTML Code Example:

<form action="submit.php" method="post">

<input type="submit" value="Submit Form">

<input type="reset" value="Reset Form">

</form>

4. Full Example:
<form action="submit.php" method="post">

<label for="username">Username:</label><br>

<input type="text" id="username" name="username"><br><br>

<p>Select your gender:</p>

<input type="radio" name="gender" value="male"> Male<br>

<input type="radio" name="gender" value="female"> Female<br>

<input type="radio" name="gender" value="other"> Other<br><br>

<label for="country">Country:</label><br>

<select name="country" id="country">

<option value="india">India</option>

<option value="usa">USA</option>

<option value="uk">UK</option>

</select><br><br>

<input type="submit" value="Submit">

<input type="reset" value="Reset">

</form>

You might also like