<?php
session_start();
$mysql_host = 'localhost';
$mysql_user = 'root';
$mysql_pass = '';

$mysql_db = 'grey';

$conn = mysqli_connect($mysql_host, $mysql_user, $mysql_pass, $mysql_db);
    
    if(isset($_POST['edit'])){
        $id = $_SESSION['id'];
        
        $fullname = $_POST['fullname'];
        $email = $_POST['email'];
        $phone = $_POST['phone'];
        $country = $_POST['country'];
        $gender = $_POST['gender'];
        
        $query = "UPDATE users SET fullname='$fullname', email='$email', phone='$phone', country='$country', gender='$gender' WHERE id='$id' ";
        $query_run = mysqli_query($conn, $query);
        
        if($query_run){
            header("Location: info.php");
        }else{
            echo 'data not updated';
        }
    }

?>