<?php
    $to = "d00309511@dmail.dixie.edu";
    $subject = "Request for Service";
    $fname = $_POST['fname'];
    $lname = $_POST['lname'];
    $email = $_POST['email'];
    $phone = $_POST['phonenumber'];
    $facility = $_POST['facility'];
    $rooms = check_input($_POST['rooms']);
    $howcontact = check_input($_POST['howcontact']);
    $selectedServicetype = 'None';
    if(isset($_POST['servicetype']) && is_array($_POST['servicetype']) && count($_POST['servicetype']) > 0){
        $selectedServicetype = implode(', ', $_POST['servicetype']);
    }

    $message = "From: $fname $lname\n
                Phone: $phone\n
                Email: $email\n
                Location Type: $facility\n
                Services needed: $selectedServicetype\n
                Rooms: $rooms\n
                Contact method: $howcontact\n";
    $serviceneeded .='Services Needed: ' . $selectedServicetype;

    mail($to,$subject,$message);
?>

