<?php
/**
 * Created by PhpStorm.
 * User: sunusi
 * Date: 2019-01-24
 * Time: 19:40
 */

session_start();

require_once getcwd() . "/../functions/db.class.php";
require_once getcwd() . "/../functions/form.data.php";
require_once getcwd() . "/../functions/robot.php";
require_once getcwd() . "/../functions/config.php";



if (isset($_POST["userId"])) {

    $query = new db();
    /*
     * adding other information to the array
     */

//    $_POST["userId"] = $_SESSION["YUZA_ID"];

    /*$condition = "`patientId` = '" . $_POST["patientId"] . "' ";
    $SQLPatients = SQLStmtUpdate("udut_patients", $_POST, $condition);*/

    $SQLPatients = "UPDATE udut_users SET userFullname = '".$_POST["userFullname"]."', userGender = '".$_POST["userGender"]."', userDateOfBirth = '".$_POST["userDateOfBirth"]."', userEmail = '".$_POST["userEmail"]."', userPhone = '".$_POST["userPhone"]."', userUsername = '".$_POST["userUsername"]."', userPassword = '".$_POST["userPassword"]."' WHERE `userId` = '" . $_POST["userId"] . "'   ";


    /*
     * Saving the patient details
     */
     $update = $conn->query($SQLPatients);


    header("location: ../about-user/" . $_POST["userId"]);

} else {
    header("location: ../add-user");
}