<?php
if ($_SERVER["REQUEST_METHOD"] == "POST") {
    // Ambil data dari formulir
    $full_name = $_POST["full_name"];
    $usernamess = $_POST["username"];
    $institution = $_POST["institution"];
    $email = $_POST["email"];
    $passwordsss = $_POST["password"];
    

    // Validasi data (misalnya, pastikan email unik)
    // ...

    // Lakukan penyisipan data ke dalam database
    $servername = "localhost";
    $database = "borneom2_percobaan";
    $username = "borneom2_borneo";
    $password = "borneom2_borneo";

    $conn = mysqli_connect($servername, $username, $password, $database);

    if (!$conn) {
        die("Koneksi Gagal: " . mysqli_connect_error());
    }

    $sql = "INSERT INTO users (full_name, username, institution, email, password) VALUES ('$full_name', '$usernamess', '$institution', '$email', '$passwordsss')";

    if (mysqli_query($conn, $sql)) {
        echo "Registrasi berhasil. Silakan login.";
    } else {
        echo "Error: " . $sql . "<br>" . mysqli_error($conn);
    }

    mysqli_close($conn);
} else {
    echo "Akses tidak valid";
}
?>