editUser state api

This commit is contained in:
Kar l5
2024-05-03 01:32:00 +05:30
parent eb4f5f8f25
commit 4808471bfb
2 changed files with 16 additions and 2 deletions

1
.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
.hta_config/

View File

@@ -49,7 +49,7 @@
$stmt->bindParam(':pass', $password);
$stmt->bindParam(':id', $user_id);
$stmt->execute();
echo "Record Updated successfully";
echo '<script> window.location.assign("/admin/users") </script>';
} catch(PDOException $e) {
echo "Error: " . $e->getMessage();
}
@@ -66,7 +66,7 @@
if ($num_rows >= 1) {
foreach($rows as $row){?>
<div class="flex flex-col place-items-center mt-4">
<form action="" method="post" class="max-w-2xl shadow-xl p-4 rounded-lg">
<form id="form_edit_user" method="post" class="max-w-2xl shadow-xl p-4 rounded-lg">
<p class="my-4" style="border-bottom: 2px solid #464E5F; border-style: dashed; font-size: 20px; font-weight: bold" >Edit User</p>
<div style="display: flex; flex-direction: column;">
<label for="name">Name:</label>
@@ -184,6 +184,19 @@
?>
<script>
// Check if the page is refreshed
if (performance.navigation.type === 1) {
// Disable form submission on refresh
window.onload = function () {
document.getElementById("form_edit_user").addEventListener("submit", function (event) {
event.preventDefault();
alert("Form submission is disabled on refresh.");
});
};
}
</script>
<style>
/* For small screens */
@media screen and (max-width: 767px) {