<?php
error_reporting(0);

echo $_POST['fullname'].'<br>';
echo $_POST['email'].'<br>';
echo $_POST['tel'].'<br>';
echo $_POST['year'].'<br>';
echo $_POST['time'].'<br>';
echo $_POST['comments'];
echo $_POST['hometown'];
 ?>

<form action="form1.php" method="post">
<label for = "fullname">Full Name:</label><input type="text" name="fullname" id="fullname" value="<?php echo $_POST['fullname'];?>"><br>
<label for = "email">Email:</label><input type="email" name="email" id="email" placeholder="Email Address Here" value="<?php echo $_POST['email'];?>"><br>
<label for = "hometown">Hometown:</label><input type="text" name="hometown" id="hometown" placeholder="Hometown" value="<?php echo $_POST['hometown'];?>"><br>
<label for = "tel">Telephone:</label><input type="tel" name="tel" id="tel" placeholder="" value="<?php echo $_POST['tel'];?>">
    
    
    
    <br>
Year in School: <label for = "freshman">Freshman</label><input type="radio" name="year" value="freshman"  
   <?php
    if ($_POST['year'] == 'freshman'){
        echo ' checked="checked" ';
    }                                                           
                                                               
  ?>> <label for = "sophomore">Sophomore</label><input type="radio" name="year" value="sophomore" <?php
    if ($_POST['year'] == 'sophomore'){
        echo ' checked="checked" ';
    }                                                           
                                                               
  ?>><label for = "junior">Junior</label><input type="radio" name="year" value="junior" <?php
    if ($_POST['year'] == 'junior'){
        echo ' checked="checked" ';
    }                                                           
                                                               
  ?>><label for = "senior" >Senior</label><input type="radio" name="year" value="senior" <?php
    if ($_POST['year'] == 'senior'){
        echo ' checked="checked" ';
    }                                                           
                                                               
  ?>><br>
Favorite Subjects:
<label for = "math">Math</label><input type="checkbox" name="subject[]" id="math" value="math" 
                                       <?php
                                       if (in_array('math',$_POST['subject'])){
                                           echo ' checked="checked" ';
                                       }
                                    ?>
                                >
<label for = "english">English</label><input type="checkbox" name="subject[]" id="english" value="english" <?php
                                       if (in_array('english',$_POST['subject'])){
                                           echo ' checked="checked" ';
                                       }
                                             ?>>

<label for = "history">History</label><input type="checkbox" name="subject[]" id="history" value="history"
                                             
            <?php
              foreach ($_POST['subject'] as $value)
              {
                  if ($value == 'history') {
                      echo ' checked="checked" ';
                  } 
              }
                                             
            ?>                                             
                                             >

<label for = "computer">Computer Science</label><input type="checkbox" name="subject[]" id="computer" value="computer" <?php if (in_array('computer',$_POST['subject'])) echo ' checked="checked" ';?>><br>
When is your preferred time to take classes?<br>
<select name ="time">
<option value="">Choose Below</option>
<option value="morning" <?php if ($_POST['time'] == 'morning'){
    echo ' selected = "selected" ';
}
        ?>>Morning</option>
<option value="afternoon" <?php if ($_POST['time'] == 'afternoon'){
    echo ' selected = "selected" ';
}?>>Afternoon</option>
<option value="evening" <?php if ($_POST['time'] == 'evening'){
    echo ' selected = "selected" ';
}?>>Evening</option>
</select><br>
Comments:<br>
<textarea name="comments"><?php echo $_POST['comments'];?></textarea><br>
<input type="submit" name="submit" value="Register">
</form>

