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

if(isset($_POST['submit']));
{
    $accountype = mysqli_real_escape_string($connection, $_POST['accountype']);
    $fname = mysqli_real_escape_string($connection, $_POST['fname']);
    $lname = mysqli_real_escape_string($connection, $_POST['lname']);
	$city = mysqli_real_escape_string($connection, $_POST['city']);
	$zip = mysqli_real_escape_string($connection, $_POST['zip']);
    $country = mysqli_real_escape_string($connection, $_POST['country']);
    $phone = mysqli_real_escape_string($connection, $_POST['phone']);
	$saving = mysqli_real_escape_string($connection, $_POST['saving']);
    $samount = mysqli_real_escape_string($connection, $_POST['samount']);
	$id = mysqli_real_escape_string($connection, $_POST['id']);
    

  
  $query = "UPDATE users SET accountype='$accountype', fname='$fname', lname='$lname', city='$city', zip='$zip', country='$country', phone='$phone', saving='$saving', samount='$samount'  WHERE id='$id' LIMIT 1";
  $query_run = mysqli_query($connection, $query);
 
 if($query_run)
  {
 	 

	$_SESSION['id'] = $id;
	 
	 header("location:../passcode.php"); 
 }
 else
 {
	  $_SESSION['status'] = "<h5 style='padding:8px; background: #fe8b8e; border-radius: 10px; color: #fff; text-align: center;'>Failed to complete</h5>";
       
	header("location: ../register2.php");  
 }
}
 
?>