.
.
.
<?
echo "<form name='Form1' action=\"{$_SERVER['PHP_SELF']}\" method='post'>\n";
?>
<center>
<b>Enter the number of names to sort (must be between 1 and 20): </b>
<input name="n" type="text" size="3">
<br />
<p>The names will be entered in the format: first middle last, and sorted with respect
to the format: last first middle.
</p>
<input type="hidden" name="submitted1" value="true">
<input type="submit" value="SUBMIT"> <input type="reset" value="RESET">
</center>
</form>
.
.
.
if (isset($_POST['submitted1']))
{
        $number_of_names = $_POST['n'];
        if ($number_of_names >= 1 && $number_of_names <= 20)
        {
                echo "<center><form name='Form2' action=\"{$_SERVER['PHP_SELF']}\" method='post'>";
                for ($i = 1; $i <= $number_of_names; $i++)
                {
                        echo "<b>Enter a name in the format: first middle last: </b>\n";
                        echo "<input name=\"$i\" type='text' size='30' value=\"$_POST[$i]\"><br />\n";
                }
echo <<< HERE
                <input type="hidden" name="submitted2" value="true">
                <input type="hidden" name="n" value="$number_of_names">
                <input type="submit" value="SUBMIT"> <input type="reset" value="RESET">
                </form></center>
                <hr/>
HERE;
        }
        else
                echo "The number has to be between 1 and 20.<br>\n";
}

if (isset($_POST['submitted2']))
{
	.
	.
	.
}

.
.
.


