<?php

include_once '../includes/autoloader.php';
include_once '../includes/function.php';
$obj = new bank;
$mesasage  = purify(trim($_POST["mesasage"]));
$messaeHeader  = purify(trim($_POST["messaeHeader"]));
$link = purify($_POST["id"]);
$fetch = $obj->fetch_card($link);
// var_dump($link,$link);
if ($mesasage == false) {
echo "Message cannot be empty";
} else {
if ($messaeHeader == false) {
echo "Message cannot be empty";
} else {
    $db = new dbh;
$dbconn = $db->connect();
$sql = "UPDATE `users` SET Message = '$mesasage', messaeHeader = '$messaeHeader' WHERE id = '$link'";
$conn = $dbconn->prepare($sql);
$go = $conn->execute();
if ($go) {
    echo "message update successful";
} else {
    echo "Error updating message";
}
}
}
