<?php
include("connection.php");

if (isset($_POST['submit'])) {
    $id=$_POST['id'];
    $user_name = $_POST['user_name'];
    // $password = $_POST['password'];
    $email = $_POST['user_email'];
    $user_type = $_POST['user_type'];
    $country = $_POST['country'];
    $city = $_POST['city'];

    // Assuming you have the user's ID stored in a variable named $user_id

    $update_qry = "UPDATE user SET  user_name = '$user_name', user_email = '$email', user_type = '$user_type', country = '$country', city = '$city' WHERE id = '$id'";
    $result = mysqli_query($conn, $update_qry);

    if ($result) {
        header("Location: view_all.php?success=Entry Updated Successfully!!!");
    } else {
        header("Location: view_all.php?error=Failed update!!!");
    }
} else {
    header("Location: view_all.php?error=Something went wrong!!!");
}
?>
