Outputting form result [closed]

Keeping things simple here…
You will need 2 files. A file with your form, and a file to handle your form.


<form action="submit.php" method="post">
    <select name="gender">
        <option value=""> Choose Gender </select>
        <option value="Female">Female</option>
        <option value="Male">Male</option>
    <input type="submit" value="Submit" />


    $gender = $_POST['gender'];

    // grab other input values in the same way...

    // send email or whatever else

<h1>Thank You</h1>
<p>You have said you are a <?php echo $gender; ?>.</p>

Note Make sure to sanitize any data! Using the super global $_POST directly isn’t exactly best practice, but it will work for this example.

Browse More Popular Posts

Leave a Comment