<?php

require('../lib/dbclass.php');



$id = $_GET['blockid'];

$data1 = findQuery("select * from tbl_customer where Panchayat=$id");

if ($data1) {
    $message = 'Reference exist cannot block';


    $encodedMessage = urlencode($message);



    $url = "panchayat_management.php?message={$encodedMessage}";

    // Redirect to the new URL
    echo "<script>window.location.href='{$url}';</script>";

    return;
}
$block = updateQuery("update tbl_panchayat set status=1 where id=$id");

if ($id) {
    $message = 'Blocked successfully!';



    $encodedMessage = urlencode($message);



    $url = "panchayat_management.php?message={$encodedMessage}";

    // Redirect to the new URL
    echo "<script>window.location.href='{$url}';</script>";
} else {
    $message = 'Something went wrong, please try again.';


    $encodedMessage = urlencode($message);



    $url = "panchayat_management.php?message={$encodedMessage}";

    // Redirect to the new URL
    echo "<script>window.location.href='{$url}';</script>";
}
