<?php 
include ('database.php');
session_start();

$id= $_SESSION['id'];
$results= mysqli_query($connection, "SELECT `date`, `id`, `name`, `email`, `number`, `password`, `phone`, `address`, `country`, `gender`, `image`, `vcode`, `verified`, `verify`, `balance`, `totalbalance`, `investbalance`, `profit`, `totaldeposit`, `totalwithdrawal`, `loanlimit`, `availableloan`, `ongoingloan`, `savings`, `idcard`, `idcardback`, `accountstatus`, `pina`, `pinb`, `pinc`, `pind`, `dob` FROM users WHERE id ='$id'");
$retrive= mysqli_fetch_array($results);
$date = $retrive['date'];
$id = $retrive['id'];
$name = $retrive['name'];
$email = $retrive['email'];



if(isset($_POST['submit']));
{
    
   
	 $phone = mysqli_real_escape_string($connection, $_POST['phone']);
	 $address = mysqli_real_escape_string($connection, $_POST['address']);
		$dob = mysqli_real_escape_string($connection, $_POST['dob']);
	 $gender = mysqli_real_escape_string($connection, $_POST['gender']);
	
	
	   $add_query="UPDATE users SET phone='$phone', address='$address', dob='$dob', gender='$gender' WHERE id='$id' LIMIT 1";
	 $add_query_run =  mysqli_query($connection, $add_query);
	 if($add_query_run)
    {
	
		 $_SESSION['status'] = "<h5 style='padding:8px; background: #1a1849; border-radius: 10px; color: #fff; text-align: center;'>Transfer Successful</h5>";
      
	 header("location:../profile.php"); 
 }
 else
 {
	  $_SESSION['status'] = "<h5 style='padding:8px; background: #fe8b8e; border-radius: 10px; color: #fff; text-align: center;'>Failed Try Again Later</h5>";
       
	header("location: ../failed.php");  
 }
	  }

  
?>