<?php
require_once("../../includes/database.php");
if (!empty($_POST["receiver"])) {
    $account_number = str_replace(' ', '', ($_POST["receiver"]));

    $result = mysqli_query($con, "SELECT * FROM accounts WHERE account_number='$account_number'");
    $count = mysqli_num_rows($result);
    if ($count > 0) {
        $row = mysqli_fetch_assoc($result);
        $fullName = ucfirst(($row['fname']) . " " . $row['lname']);
        echo "<span> $fullName </span>";
        echo "<script>$('#account_namebutton').prop('disabled',false);</script>";
    } else {
        echo "<span style='color:red'>Account Not Found</span>";
        echo "<script>$('#account_namebutton').prop('disabled',true);</script>";
    }
}
