<?php
include '../connect.php';
$name= $_POST['name'];
$address=$_POST['address'];
$phone = $_POST['phone'];
$user =$_POST['user'];
$pass = $_POST['pass'];
$acctype = $_POST['acctype'];
$currency = $_POST['currency'];
$serial = $_POST['serial'];
$acctnum = $_POST['acctnum'];
$date1= $_POST['date1'];
$date2 = $_POST['date2'];
$date3= $_POST['date3'];
$date4 = $_POST['date4'];
$amount1= $_POST['amount1'];
$amount2 = $_POST['amount2'];
$amount3= $_POST['amount3'];
$amount4 = $_POST['amount4'];
$new_bal = $_POST['new_bal'];



 $file = rand(1000,100000)."-".$_FILES['file']['name'];
 $file_loc = $_FILES['file']['tmp_name'];
 
 $folder="../Images/";
 move_uploaded_file($file_loc,$folder.$file);
             
$sql="INSERT INTO customers (name, address, phone, username, password, account_no, 
account_type, currency, serial, date1, date2, date3, date4, amount1, amount2, amount3, amount4, new_bal, file, date )
VALUES
('$name','$address','$phone','$user','$pass','$acctnum','$acctype','$currency','$serial','$date1','$date2','$date3','$date4','$amount1','$amount2','$amount3','$amount4','$new_bal','$file',now())";


$insert1= mysqli_query($con, $sql);
  if (!$insert1){
  die('Error: ' . mysqli_error($con));
  var_dump($sql);
  }
echo "1 record added to userdatabase. <a href='controlpanel.html'>CLICK HERE TO GO BACK TO ADMIN.</a>";

mysqli_close($con);
?>
