Skip to main content

How to make form in HTML?


 

Here in this blog, we are providing the programming codes for making an HTML form.

so here are the following codes:-


<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>forms</title>
</head>

<body>
    <h2>this is form tutorial</h2>
    <form action="backend.php">
        <!-- yaha par bas input type karo aur ek list dikhayga aur jo daalna
        hai select kar lo -->
      <!-- here label works that if label for="name" and id ="name" than if we
        will click on name on html web page than the cursor will go on the
        name entry box -->
        <label for="name">Name</label>
        <div>
            <input type="text" id="name">
        </div>
        <br>
        <div>
            Role: <input type="text">
        </div>
        <br>
        <div>
            Email: <input type="email" name="myemail">
        </div>
        <br>
        <div>Date:<input type="date" name="my date"></div>
        <br>
        <div>Bonus <input type="number" name="mybonus"></div>
        <br>
        <!-- if you want checbox to be checked than put command checked -->
        <label for="eli">Are u Eligible</label>
        <div><input type="checkbox" name="my checkbox" id="eli" checked></div>
        <br>
        <div>Gender: Male <input type="radio" name="my gender">Female
        <input type="radio" name="my gender">Other <input
                type="radio" name="my gender"></div>
        <div>Write about <br> <textarea name="mytext" cols="30" rows="10">
        </textarea></div>
        <br>
        <div>
            <label for="car">Car</label>
            <select name="mycar" id="car">
                <option value="swift">Swift</option>
          <!-- here selected works for the option that gets auto selected -->
                <option value="alto" selected>alto</option>
            </select>
        </div>
        <br>
        <div>
            <input type="submit" value="Submit Now">
            <input type="reset" value="Reset">
        </div>

    </form>
</body>

</html>


Comments