DEV Community

Cover image for PHP form 50: input text textarea checkbox
Falah Al Fitri
Falah Al Fitri

Posted on • Updated on

PHP form 50: input text textarea checkbox


Happy Coding



Previous

We will create form with type checkbox input:

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

        Firstname: <input type="text" name="firstname" />
        <br />

        Lastname: <input type="text" name="lastname" />
        <br />

        Description: <textarea name="description" rows="10" cols="50"></textarea>
        <br />
Enter fullscreen mode Exit fullscreen mode

Add input type checkbox:

        Hobby: <input type="checkbox" name="hobby"
Enter fullscreen mode Exit fullscreen mode

        <br />

        <hr />

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

    </form>
Enter fullscreen mode Exit fullscreen mode

And, the process:

    echo "<pre>";

    var_dump($_POST);
Enter fullscreen mode Exit fullscreen mode

Source Code Next


Thank for reading :)

Top comments (0)