DEV Community

ASHWINTH
ASHWINTH

Posted on

Html Form

What is html forms?
An HTML forms are elements used to collect input from users on a webpage . Forms are created using the

element, which acts as a container for various input fields such as text boxes, radio buttons, checkboxes, dropdown menus, and submit buttons.

Text Input

Used to collect short text such as names or usernames.


Password Input

Masks the entered text for security.

<input type="password" name="password">

Email Input

Ensures the entered value follows a valid email format.


Number Input cccepts only numeric values.


<input type="number" name="age">

Radio Buttons

Allows users to select only one option from a group.Allows users to select multiple options.


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

Checkboxes

Its select one or multiple values to the input fiels


<input type="checkbox" name="Language" value="english"> english
<input type="checkbox" name="language" value="tamil"> tamil

Dropdown List

create a list of options to the input fields.

<select name="country">
    <option>India</option>
    <option>USA</option>
    <option>Canada</option>
</select>

Textarea

Used for longer text input, such as comments or feedback.

<textarea name="message"></textarea>

Submit Button

Sends the form data to the server.


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

Get and Post methods

Get
Its send dats though the Url and Data is visible in the browser address bar.

http://127.0.0.1:5500/user?name=aswinth&email=aswinth%40gmail.com&phone=9865896589&address=chennai&gender=male&course=course1

Post

Sends data in the request body and More secure than GET Suitable for login forms, registrations, and sensitive information.

Conculution

They enable websites to collect information, process requests, and provide personalized experiences. By mastering form elements, validation techniques, and accessibility best practices, developers can create forms that are both user-friendly and reliable. As

Top comments (0)