<?php

include 'Class/Databases.php';
?>
        
<?php 
if (isset($_GET['id'])) {
    $db = new Databases();
    //catching the $_GET[id] variable and passing through get_row_from_databases()
    //function so that i can get spacific result set for updating the result.
    $id = $_GET['id'];
    $result_array = $db->get_row_from_databases($param = ["{$id}"]);
}
if (isset($_POST["btn"])) {
    //gatting all the post value
    $username = $_POST["username"];
    $firstname = $_POST["firstname"];
    $lastname = $_POST["lastname"];
    $email = $_POST["email"];
    $user_id = $_POST["user_id"];
    //assigned variable passing through the updateRow() function.
    //check out databases class updateRow() sql syntex WHERE
    //id = hidden field user_id.it's for updating spacific user row.
    $db->updateRow($param = ["{$username}", "{$firstname}", "{$lastname}", "{$email}", "{$user_id}"]);
}
?>
<!--head html file into template/header.php file just include here-->
<?php 
$title = "Update User Information";
include 'template/header.php';
?>