PHP form 70: complete

antelove19

Falah Al Fitri

Posted on December 14, 2019

PHP form 70: complete

Happy Coding

index.php

    <form method="post" action="process.php" enctype="multipart/form-data" >

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

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

        Description: <textarea name="description" rows="10" cols="50"></textarea>
        <br />

        Gender:
        <input type="radio" name="gender" value="male" checked /> Male
        <input type="radio" name="gender" value="female" /> Female
        <br />

        Programming Language (single):
        <select name="language" >
            <option value="c" >C</option>
            <option value="c++" >C++</option>
            <option value="java" >Java</option>
            <option value="javascript" >Javascript</option>
            <option value="php" selected >PHP</option>
        </select>
        <br />

        Programming Languages (multiple):
        <select name="languages[]" multiple >
            <option value="c" >C</option>
            <option value="c++" >C++</option>
            <option value="java" >Java</option>
            <option value="javascript" selected >Javascript</option>
            <option value="php" selected >PHP</option>
        </select>
        <br />

        Hobbies (single): <input type="checkbox" name="hobby" value="studying" /> Studying
        <br />

        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 />

        File Upload: <input type="file" name="upload" /><br />
        Preview: <img src="#" /> <br />

        <hr />

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

    </form>
Enter fullscreen mode Exit fullscreen mode

process.php

$data = array(
    "post"  => $_POST,
    "files" => $_FILES
);

echo "<pre>";

// echo json_encode($data);

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

Output


Demo repl.it


Thank for reading :)

💖 💪 🙅 🚩
antelove19
Falah Al Fitri

Posted on December 14, 2019

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related

PHP form 70: complete
php PHP form 70: complete

December 14, 2019

PHP form 71: complete upload
php PHP form 71: complete upload

December 14, 2019