The code for the form to be utilized for this assignment is shown
below. This needs to be saved as a PHP file (e.g.,
lab19_form.php).
<!--
Mark Motl
CS 4312
Lab 19
-->
<?php
/* Check the protocol for this request. Redirect an HTTP request to
an HTTPS request.
Ref.: https://stackoverflow.com/questions/5106313/redirecting-from-http-to-https-with-php
*/
if (empty($_SERVER['HTTPS']) || $_SERVER['HTTPS'] === "off")
{
$location = 'https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
header('HTTP/1.1 301 Moved Permanently');
header('Location: ' . $location);
exit;
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<title>Lab 19 Jumble Word Solver</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
</head>
<body>
<h1>Lab 19 Jumble Word Solver</h1>
<p>
This form allows a user to enter a Jumble word. Words must be at least four
and at most seven letters long. The associated PHP application prints
possible solutions.
</p>
<form action="lab19.php" method="post">
<p>Jumble Word: <input type="text" name="word" /><br /></p>
<p><input type="reset" value="Clear Form" />
<input type="submit" name="Submit" value="Solve It" /></p>
</form>
<p>
<?php
$location = 'https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
$location = urlencode($location);
echo '<a href="https://validator.w3.org/nu/?doc=' . $location . '">';
?>
<img src="https://www.w3.org/QA/Tools/I_heart_validator"
alt="I heart Validator logo" height="31" width="80" />
</a>
</p>
</body>
</html>