function edit_post($post_id)
{
    // validácia post poľa pre pridanie
    if (!($data = validate_post($post_id))) {
        return false;
    }
    global $db;
    try {
        $query = $db->prepare("UPDATE posts SET title = :title, text = :text WHERE id = :id");
        $query->execute(array("id" => $post_id, "title" => $data["title"], "text" => $data["text"]));
    } catch (PDOException $e) {
        return false;
    }
    delete_tags_from_post($post_id);
    add_tags_to_post($post_id, $data["tags"]);
    add_message("Článok bol aktualizovaný.");
    return true;
}
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Document</title>

  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">

  <link rel="stylesheet" href="css/bootstrap.min.css">
</head>

<body>
  <div class="container">
    <div class="row">
      <?php 
validate_post();
?>
    </div>
  </div>

</body>
</html>

<?php 
function validate_post()
{
    if (isset($_POST['input_first_name']) && isset($_POST['input_last_name']) && isset($_POST['input_birthday']) && isset($_POST['input_email']) && isset($_POST['input_telephone'])) {
        output_post();
        create_file();
    } else {
        echo "<h1>Error! Required fields are not filled!<h1>";