logo CBCE Skill INDIA

Welcome to CBCE Skill INDIA. An ISO 9001:2015 Certified Autonomous Body | Best Quality Computer and Skills Training Provider Organization. Established Under Indian Trust Act 1882, Govt. of India. Identity No. - IV-190200628, and registered under NITI Aayog Govt. of India. Identity No. - WB/2023/0344555. Also registered under Ministry of Micro, Small & Medium Enterprises - MSME (Govt. of India). Registration Number - UDYAM-WB-06-0031863

HTML Form


HTML Form

  • An HTML form is used to collect user input and send it to the server for processing. Forms are created using the <form> element, and various form controls like text inputs, checkboxes, radio buttons, and buttons can be added inside the form to gather user data. Here's a basic example of an HTML form with a few input elements:
<!DOCTYPE html>
<html>
<head>
    <title>HTML Form Example</title>
</head>
<body>
    <h1>Contact Form</h1>
    <form action="/submit_form.php" method="POST">
        <label for="name">Name:</label>
        <input type="text" id="name" name="name" required>
        <br>

        <label for="email">Email:</label>
        <input type="email" id="email" name="email" required>
        <br>

        <label for="message">Message:</label>
  <textarea id="message" name="message" rows="4" cols="30" required>
         </textarea>
        <br>

        <input type="checkbox" id="subscribe" name="subscribe">
        <label for="subscribe">Subscribe to newsletter</label>
        <br>

        <input type="radio" id="male" name="gender" value="male">
        <label for="male">Male</label>
        <input type="radio" id="female" name="gender" value="female">
        <label for="female">Female</label>
        <br>

        <input type="submit" value="Submit">
        <input type="reset" value="Reset">
    </form>
</body>
</html>


In this example, we have a contact form with the following form controls:

  1. Text Input: `name` for the user's name.
  2. Email Input: `email` for the user's email address.
  3. Textarea: `message` for the user's message.
  4. Checkbox: `subscribe` to opt-in for a newsletter.
  5. Radio buttons: `gender` to choose between male and female.
  6. Submit Button: To submit the form.
  7. Reset Button: To reset the form fields.

 

The form's action attribute is set to "/submit_form.php," which means the form data will be sent to the "/submit_form.php" script on the server-side using the HTTP POST method. You can change the action attribute to the appropriate server-side script that will handle the form data submission and processing.

Thank You.


Give us your feedback!

Your email address will not be published. Required fields are marked *
0 Comments Write Comment