From c8ab3ad24c5c27007f2cb8ea057e6b4f24a7cd40 Mon Sep 17 00:00:00 2001 From: Kar l5 Date: Fri, 3 May 2024 15:42:01 +0530 Subject: [PATCH] edit user states access --- .hta_slug/admin/edit-user.php | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/.hta_slug/admin/edit-user.php b/.hta_slug/admin/edit-user.php index ae07b35..3f28bbb 100644 --- a/.hta_slug/admin/edit-user.php +++ b/.hta_slug/admin/edit-user.php @@ -36,16 +36,28 @@ } } $access_value = implode(',', $access_values_array); + + $states_list = ["international", "ML", "HR", "MH", "GA", "MN", "PY", "TG", "OR", "RJ", "PB", "UT", "AP", "NL", "LD", "HP", "DL", "UP", "AN", "AR", "JH", "KA", "AS", "KL", "JK", "GJ", "CH", "DH", "SK", "TN", "MZ", "BR", "TR", "MP", "CT", "LA", "WB"]; + + $states_access_array = []; + foreach ($states_list as $states) { + if (isset($_POST[$states])) { + $states_access_array[] = $_POST[$states]; + } + } + $states_access_value = implode(',', $states_access_array); + $name = $_POST['name']; $email = $_POST['email']; $phone = $_POST['phone']; $password = md5($_POST['pass']); $user_id = $_GET['id']; - $stmt = $conn->prepare("UPDATE users SET name = :name, email = :email, mobile = :mobile, access = :access, pass = :pass WHERE id = :id"); + $stmt = $conn->prepare("UPDATE users SET name = :name, email = :email, mobile = :mobile, access = :access, states = :states, pass = :pass WHERE id = :id"); $stmt->bindParam(':name', $name); $stmt->bindParam(':email', $email); $stmt->bindParam(':mobile', $phone); $stmt->bindParam(':access', $access_value); + $stmt->bindParam(':states', $states_access_value); $stmt->bindParam(':pass', $password); $stmt->bindParam(':id', $user_id); $stmt->execute(); @@ -150,7 +162,7 @@ foreach ($states as $state) { $isChecked = in_array($state["iso2"], $ustate); - echo ''; + echo ''; echo '
'; } }