I am writing an HTML form which needs to be handled with a PHP file.
This is my client-side HTML code:
<h1>Marching Band Camp Registration</h1>
<p>Please fill out this form completely for your child to be eligible to participate in the upcoming marching season for the Eagle Band</p>
<h2>Student Information</h2>
<form action="formhandle.php" method="post">
First Name: <input type="text" name="firstname"><br>
Last Name: <input type="text" name="lastname" />
</form>
<form action="formhandle.php">
<p>Please select your classification for the upcoming fall semester:
<br /> <br />
<input type="radio" name="class" value="F" checked="checked" /> Freshman
<input type="radio" name="class" value="SO" checked="checked" /> Sophomore
<input type="radio" name="class" value="J" checked="checked" /> Junior
<input type="radio" name="class" value="SR" checked="checked" /> Senior
<input type="submit">
</p>
</form>
This is my server-side PHP code to handle it:
<?php $fn = $_POSTS["firstname"]; ?>
Thank you for registering, <?php echo $fn ; ?> <br>
<?php $ln = $_POST["lastname"]; ?>
<?php echo $ln ; ?>
Your Summary is as follows: <br>
<br>
<?php
$_GET["class"];
echo "Class:";
echo "<br>";
echo $_GET["class"];
?>
Only one item (Class) is showing up after submit. How can I make it so that all the items I want to show are shown? Am I doing something wrong with the $_POST
and $_GET
functions? I also want to add in other criteria, but if I can't get multiple items to show with just these three, I feel like I'm going to have a very bad time trying to add in even more criteria.
I'm making a longer form, that will have multiple inserted sections. I'm trying to figure out which to use, $_POST
or $_GET
. I tried one, turned it off, did the other, but I get the same problem of just either first name showing up, or just classification. My full ideal version has 1 radio button, 3 checkboxes, and 2 or 3 dropdown menu options. But I kept it minimal here to figure out why I can't get more than 1 to show simultaneously, regardless of which $_GET or $_POST I use. It will be one form so I only need ONE submit icon. One icon will submit the entire form, correct?