index.html
<!DOCTYPE html>
<html>
<head>
<title>Account Sign Up</title>
<link rel="stylesheet" href="main.css"/>
</head>
<body>
<main>
<h1>Account Sign Up</h1>
<form action="display_results.php" method="post">
<fieldset>
<legend>Account Information</legend>
<label>E-Mail:</label>
<input type="text" name="email" value="" class="textbox">
<br>
<label>Password:</label>
<input type="password" name="password" value="" class="textbox">
<br>
<label>Phone Number:</label>
<input type="text" name="phone" value="" class="textbox">
</fieldset>
<fieldset>
<legend>Settings</legend>
<p>How did you hear about us?</p>
<input type="radio" name="heard_from" value="Search Engine">
Search engine<br>
<input type="radio" name="heard_from" value="Friend">
Word of mouth<br>
<input type=radio name="heard_from" value="Other">
Other<br>
<p>Would you like to receive announcements about new products
and special offers?</p>
<input type="checkbox" name="wants_updates">YES, I'd like to receive
information about new products and special offers.<br>
<p>Contact via:</p>
<select name="contact_via">
<option value="email">Email</option>
<option value="text">Text Message</option>
<option value="phone">Phone</option>
</select>
<p>Comments:</p>
<textarea name="comments" rows="4" cols="50"></textarea>
</fieldset>
<input type="submit" value="Submit">
<br>
</form>
</main>
</body>
</html>
display results php
<?php
// get the data from the form
$email = filter_input(INPUT_POST, 'email', FILTER_VALIDATE_EMAIL);
// get the rest of the data for the form
$password = filter_input(INPUT_POST,'password');
$phone = filter_input(INPUT_POST,'phone');
$contact = filter_input(INPUT_POST,'contact_via');
$comment = filter_input(INPUT_POST, 'comments');
$comment = nl2br(htmlspecialchars($comment),false);
// for the heard_from radio buttons,
// display a value of 'Unknown' if the user doesn't select a radio button
$from = filter_input(INPUT_POST, 'heard_from');
if ($from === NULL) {
$from = 'unknown';}
// for the wants_updates check box,
// display a value of 'Yes' or 'No'
$updates = filter_input(INPUT_POST, 'wants_updates');
if ($updates == NULL) {
$updates = 'No';}
?>
<!DOCTYPE html>
<html>
<head>
<title>Account Information</title>
<link rel="stylesheet" href="main.css"/>
</head>
<body>
<main>
<h1>Account Information</h1>
<label>Email Address:</label>
<span><?php echo htmlspecialchars($email); ?></span><br>
<label>Password:</label>
<span><?php echo $password ?></span><br>
<label>Phone Number:</label>
<span><?php echo $phone ?></span><br>
<label>Heard From:</label>
<span> <?php echo $from?></span><br>
<label>Send Updates:</label>
<span> <?php echo $updates ?></span><br>
<label>Contact Via:</label>
<span> <?php echo $contact ?></span><br><br>
<span>Comments:</span><br>
<span> <?php echo $comment; ?></span><br>
</main>
</body>
</html>