HTML forms give you the ability to ask for information from your viewers and then be able to do something with the values. HTML forms are a single component of what is required to build a complete solution. For the demonstration the HTML form sends values to a PHP script on a LAMP server. (Linux, Apache, MySQL, PHP).
form.html
<form action="./parseForm.php" method="post">
Name <input type="text" name="name"><br>
Gender <select name="gender">
<option value=""></option>
<option value="boy">Boy</option>
<option value="girl">Girl</option>
</select><br><br>
Why Do You Want Job?<br>
<input type="checkbox" name="fun">Fun<br>
<input type="checkbox" name="networking">Networking<br>
<input type="checkbox" name="workExperience">Work Experience<br>
<br>
T Shirt Size<br>
<input type="radio" name="shirtSize" value="small">Small<br>
<input type="radio" name="shirtSize" value="medium">Medium<br>
<input type="radio" name="shirtSize" value="large">Large<br>
<br>
Preferred Shift<br>
<input type="radio" name="shift" value="morning">Morning<br>
<input type="radio" name="shift" value="afternoon">Afternoon<br>
<input type="radio" name="shift" value="evening">Evening<br>
<input type="submit" value="submit">
formParse.php
<?php
$name = $_POST['name'];
$gender = $_POST['gender'];
$fun = $_POST['fun'];
$networking = $_POST['networking'];
$workExperience = $_POST['workExperience'];
$shirtSize = $_POST['shirtSize'];
$shift = $_POST['shift'];
echo "Name: $name<br>";
echo "Gender: $gender<br>";
echo "Wants Fun: $fun<br>";
echo "Wants Networking: $networking<br>";
echo "Wants Work Experience: $workExperience<br>";
echo "Shirt Size: $shirtSize<br>";
echo "Shift: $shift<br>";
?>
Be the first to comment