Here is my swift for registering the user:
//Information fields
@IBOutlet weak var user: UITextField!
@IBOutlet weak var pass: UITextField!
@IBOutlet weak var pass2: UITextField!
@IBOutlet weak var name: UITextField!
@IBOutlet weak var email: UITextField!
@IBOutlet weak var Message: UILabel!
//Register button
@IBAction func register(_ sender: Any) {
    let Parameters = ["username": user.text, "password": pass.text, "email": email.text, "name": name.text]
    let url = URL(string: "http://cgi.soic.indiana.edu/~lvweiss/prof4/register.php")!
    let session = URLSession.shared
    var request = URLRequest(url: url)
    request.httpMethod = "POST"
    do {
        request.httpBody = try JSONSerialization.data(withJSONObject: Parameters, options: .prettyPrinted)
    } catch let error {
        print(error.localizedDescription)
        Message.text = String(error.localizedDescription)
    }
    request.addValue("application/json", forHTTPHeaderField: "Content-Type")
    request.addValue("application/json", forHTTPHeaderField: "Accept")
    let task = session.dataTask(with: request as URLRequest, completionHandler: { data, response, error in
        guard error == nil else {
            return
        }
        guard let data = data else {
            return
        }
        do {
            if let json = try JSONSerialization.jsonObject(with: data, options: .mutableContainers) as? [String: Any] {
                print(json)
                }
        } catch let error {
            print(error.localizedDescription)
            self.Message.text = String(error.localizedDescription)
        }
    })
    task.resume()
}
override func viewDidLoad() {
    super.viewDidLoad()
    // Do any additional setup after loading the view, typically from a nib.
}
override func didReceiveMemoryWarning() {
    super.didReceiveMemoryWarning()
    // Dispose of any resources that can be recreated.
}
Here is the PHP:
<?php
require_once 'DbOperation.php';
$response = array();
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
if (!verifyRequiredParams(array('username', 'password', 'email', 'name'))) {
    //getting values
    $username = $_POST['username'];
    $password = $_POST['password'];
    $email = $_POST['email'];
    $name = $_POST['name'];
    //creating db operation object
    $db = new DbOperation();
    //adding user to database
    $result = $db->createUser($username, $password, $email, $name);
    //making the response accordingly
    if ($result == USER_CREATED) {
        $response['error'] = false;
        $response['message'] = 'User created successfully';
    } elseif ($result == USER_ALREADY_EXIST) {
        $response['error'] = true;
        $response['message'] = 'User already exist';
    } elseif ($result == USER_NOT_CREATED) {
        $response['error'] = true;
        $response['message'] = 'Some error occurred';
    }
} else {
    $response['error'] = true;
    $response['message'] = 'Required parameters are missing';
}
} else {
$response['error'] = true;
$response['message'] = 'Invalid request';
}
//function to validate the required parameter in request
function verifyRequiredParams($required_fields)
{
//Looping through all the parameters
foreach ($required_fields as $field) {
    //if any requred parameter is missing
    if (!isset($_POST[$field]) || strlen(trim($_POST[$field])) <= 0) {
        //returning true;
        return true;
    }
}
return false;
}
echo json_encode($response);
?>
Here is the information I am trying to post to the database: iOS Registration Fields:
And the error I am receiving from Xcode when hitting the register button:
2017-11-14 00:42:01.529344-0500 WeissProf4[8754:662299] [MC] Lazy loading NSBundle MobileCoreServices.framework
2017-11-14 00:42:01.530670-0500 WeissProf4[8754:662299] [MC] Loaded MobileCoreServices.framework
2017-11-14 00:42:01.550941-0500 WeissProf4[8754:662299] [MC] System group container for systemgroup.com.apple.configurationprofiles path is /Users/leviweiss/Library/Developer/CoreSimulator/Devices/C98EE410-1CA2-4B4B-9ED8-A4F112C629E2/data/Containers/Shared/SystemGroup/systemgroup.com.apple.configurationprofiles
2017-11-14 00:42:03.468653-0500 WeissProf4[8754:662299] [MC] Reading from private effective user settings.
2017-11-14 00:42:04.769899-0500 WeissProf4[8754:662505] [MC] Invalidating cache
2017-11-14 00:42:05.281372-0500 WeissProf4[8754:662299] [MC] Reading from private effective user settings.
["message": Required parameters are missing, "error": 1]
I'm not sure what is going on, I know the PHP is successfully connecting to the DB and is able to post the required info (tested with Postman). I am thinking it could be an error with how Swift deals with posting in PHP, although I am absolutely not a PHP expert.

