DEV Community

Cover image for PHP form 55: input text textarea checkbox-multiple

PHP form 55: input text textarea checkbox-multiple

Falah Al Fitri
I am Developer
Updated on ・1 min read

Happy Coding


We will create form with type checkbox multi 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 />

Add input type checkbox with all name are same and in array postfix []:

        Hobbies (multiple):
        <input type="checkbox" name="hobbies[]" value="studying" /> Studying
        <input type="checkbox" name="hobbies[]" value="reading" checked /> Reading
        <input type="checkbox" name="hobbies[]" value="writing" /> Writing
        <input type="checkbox" name="hobbies[]" value="sleeping" checked /> Sleeping

        <br />

        <hr />

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


And, the process:

    echo "<pre>";


Source Code Next

Thank for reading :)

Discussion (0)