<?php
require 'functions.php';
$id = $_GET["id"];
$data = query("SELECT * FROM data_student WHERE id = $id")[0];
$testimoni = $data["testimoni"];
?>

<!DOCTYPE html>
<html lang="id">
<head>
    <meta charset="UTF-8">
    <title>Baca Testimoni</title>
</head>
<body>
    <h2>Testimoni dari <?= htmlspecialchars($data["nama"]); ?></h2>
    <p><?= nl2br(htmlspecialchars($testimoni)); ?></p>

    <script>
        // Text-to-Speech untuk isi testimoni
        const msg = new SpeechSynthesisUtterance(<?= json_encode($testimoni); ?>);
        msg.lang = 'id-ID'; // Bahasa Indonesia
        msg.rate = 1;       // Kecepatan bicara
        msg.pitch = 1;      // Nada suara
        window.speechSynthesis.speak(msg);
    </script>
</body>
</html>
