    <!doctype html>
    <html lang="en">
    <head>
      <meta charset="utf-8">
      <title>Registration Form</title>
    </head>
    <body>
    
<?php
error_reporting(E_ALL);//checks for all errors, warnings and notices
//use error_reporting(0) to turn off!
//var_dump($_POST);
if ($_POST['submit']){ //checks that the submit button was pressed we used this to remove notices
    $content = ''; //initialize variabel for mail
  foreach ($_POST as $key=>$value){ //this will break apart the entire $_POST array into key value pairs...note the => that's what connects them!
            if ($key == 'submit'){ //this continues the loop as the submit button will have unnecessary value...note the ==
                continue;
            }

       if (is_array($value)){ //this test to see if the value is an array...specifically for check boxes and to remove warnings if no checkbox is selected
        $content .= '<strong>'.ucfirst($key).'</strong> : '; //here we are outputting the key of that checkbox with bold tags (html) and the ucfirst function that is built in php to make the first character uppercase
         foreach ($value as $individualvalue){ //now we need to loop around that array of values that the checkboxes sent....
          $content .=  $individualvalue.', ';//we're continually adding to the content variable...note the .= and note the comma at the end
         }
         $content .= '<br>'; //this adds a break tag after the checkbox list
       }
       else { //this else is for all values not an array...basically everything that is not a checkbox!

        $content .= '<strong>'.ucfirst($key).'</strong> : '.$value.'<br>';//adding these to the content variable!
    }//closes the if/else on the array
  }// closes the foreach loop of the $_POST variable
  mail('ksecor@sdccd.edu','Contact Info',$content,"Content-type: text/html:");//emails me with html...mail address,subject line,content, type of data
  echo "Thank you, we'll be in touch<br>";//outputs a response
}
?>
        
        
    <form action="formbetter.php" method="post">
    
        
    <label for = "studentid"><strong>Student ID:</strong></label><input type="text" id="studentid" name="studentid" placeholder="Student Id" required="required"><br>
        
    <label for = "firstname"><strong>First Name:</strong></label>

    <input type="text" id="firstname" name="firstname" placeholder="First Name" required="required"><br>
        
    <label for = "Last Name"><strong>Last Name:</strong></label>
    <input type="text" id="lastname" name="lastname" placeholder="Last Name" required="required"><br>
    <label for = "email"><strong>Email:</strong></label>
    <input type="email" id="emaill" name="email" placeholder="Email" required="required"><br>
    <br>
    <fieldset><legend>
        
    <em>What type of degree?</em><br>
    <label for = "bach">Bachelors</label>
    <input type="radio" name = "degree" value="bachelor" id="bach">
    <label for = "ass">Associates</label>
    <input type="radio" name = "degree" value="associates" id="ass"> 
    <br>
    <br>    
    
    <em>How do you commute to school?</em><br>
        
        
    <label for = "carpool">Carpool</label>
    <input type="checkbox" name = "transportation[]" value="carpool" id="carpool"> 
        
    <br><label for = "personalvehicle">Personal vehicle</label><input type="checkbox" name = "transportation[]" value="personalvehicle" id="personalvehicle"> 
    <br>
    <label for = "publictransportation">Public transportation</label>
    <input type="checkbox" name = "transportation[]" value="publictransportation" id="publictransportation"> 
    <br><label for = "other">Other</label>
    <input type="checkbox" name = "transportation[]" value="other" id="other"> <br>
        
    <p><em>Years attended college?</em></p>
        <select name= "yearsattended">
            <option value="1-2">1-2 years</option> 
            <option value="3-4">3-4 years</option> 
            <option value="5 or more">5 years or more</option> 
        </select><br>
        <p><em>Total units 2019 Spring semester:</em></p>
        <textarea name="comments"></textarea><br>
        <button name="submit" value="Submit">Submit</button>
    
</legend></fieldset>
        
    </form>    








    </body>
    </html>