<?php
include 'koneksi.php';
session_start();
if (!isset($_SESSION['login_admin'])) {
    header('Location: dashboard.php');
    exit;
}

if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    $visi = mysqli_real_escape_string($host, $_POST['visi']);
    $misi = mysqli_real_escape_string($host, $_POST['misi']);
    $list_misi = mysqli_real_escape_string($host, $_POST['list_misi']);

    $query = "UPDATE tb_visimisi SET visi='$visi', misi='$misi', list_misi='$list_misi' WHERE id_visimisi=1";
    if (mysqli_query($host, $query)) {
        echo "<script>alert('Update berhasil!'); window.location.href='edit_visimisi.php';</script>";
    } else {
        echo "Error updating record: " . mysqli_error($host);
    }
}
?>

