<?php
include('../includes/header.php');
// set error reporting to all
error_reporting(E_ALL);
echo('<h1>Jenna\'s $_GET form</h1>');
// variables passed via the GET ternary operators
$step = isset($_GET['step']) ? $_GET['step'] : 0;
$name = isset($_GET['name']) ? $_GET['name'] : '';
$phone = isset($_GET['phone']) ? $_GET['phone'] : '';
// filter input from Browser for security
$step = htmlentities($step);
$name = htmlentities($name);
$phone = htmlentities($phone);
if ($step == 0)
{
?>
<form action="getform.php" method="GET" class="pad">
<label for="name">Name</label>
<input type="text" size="36" id="name" name="name" value="">
<br><br>
<label for="phone">Phone</label>
<input type="text" size="36" id="phone" name="phone" value="">
<br><br>
<input type="hidden" name="step" value="1">
<input type="submit" name="submit" value="Submit">
</form>
<?php
}
else //show the information from the form
{
echo('<p>The following is what the form gathered</p>');
echo('<pre>');
print_r($_GET); //this will dump contents of $_GET array
echo('</pre>');
// load a new form to try again
?>
<form action="getform.php" method="GET">
<input type="hidden" name="step" value="0">
<input type="submit" name="submit" value="Try Again">
</form>
<?php
}
include('../includes/footer.php');
?>