<?php
include '../auth.php';
include '../../koneksi.php';

$user_id = $_SESSION['user_id']; 

if ($_SERVER["REQUEST_METHOD"] == "POST") {
  $id = $_POST['id'];
  $nama_konsumen = $_POST['nama_konsumen'];
  $ulasan = $_POST['ulasan'];

  $query = "UPDATE detail_testimoni SET nama_konsumen = '$nama_konsumen', ulasan_konsumen = '$ulasan' WHERE id_detail_testimoni = '$id'";

  if (mysqli_query($conn, $query)) {
    $_SESSION['success'] = "Data Testimoni berhasil diperbarui!";
    header("Location: ../testimoni"); // Redirect ke halaman testimoni
    exit();
  } else {
    $_SESSION['error'] = "Gagal memperbarui testimoni!";
    header("Location: ../testimoni");
    exit();
  }
}
?>