<?php
$servername = "localhost";
$username = "root";
$password = "";
$database = "membership";

$connection = new mysqli($servername, $username, $password, $database);

$id = "";
$cad4 = "";

$errorMessage = "";
$successMessage = "";

if ($_SERVER['REQUEST_METHOD'] == 'GET') {

    if (!isset($_GET["id"])) {
        header("location: approveva.php");
        exit;
    }

    $id = $_GET["id"];

    $sql = "UPDATE peserta SET cad4=1 WHERE id=$id";
    $result = $connection->query($sql);

    if (!$row) {
        header("location: approveva.php");
        exit;
    }
}
?>