<?php 
include_once 'connectdb.php';
if(isset($_POST['btn-save']))
{

 
	
	 $conn = mysqli_connect($host, $username, $password, $database);
                                                    
                                                    // Check connection
                                                    
                                                    if (!$conn) {
                                                          die("Connection failed: " . mysqli_connect_error());
                                                    }
                                                     
                                                    echo ""; 
                                                    
                                                    $db_select = mysqli_select_db($con, $database);
						   
						                            
						                           	$email = $_REQUEST['email'];
                                                	$bank_name = $_REQUEST['bank_name'];
                                                	$acc_no = $_REQUEST['acc_no'];
                                                	$acc_name = $_REQUEST['acc_name'];
                                                	$amount = $_REQUEST['amount'];
                                                	$date = $_REQUEST['date'];
                                                	$status = $_REQUEST['status'];
                                                	$swift = $_REQUEST['swift'];
                                                	$type = $_REQUEST['type'];
                                                	$remarks = $_REQUEST['remarks'];
                                                	$routing = $_REQUEST['routing'];
                                           
                                           
                                                        
          $sql = "INSERT INTO `transfer` (`id`, `acc_no`, `email`, `bank_name`, `acc_name`, `amount`, `date`, `swift`, `status`, `type`, `remarks`, `routing`) 
          VALUES (NULL, '$acc_no', '$email', '$bank_name', '$acc_name', '$amount', '$date', '$swift', '$status', '$type', '$remarks', '$routing')";                                              
                                                    
         
     
                                           
                                                    
                            						 
                            						   $insert=mysqli_query($conn, $sql);
                            						   
                            						   if($insert){
                            						       
                            						     	header("Location: add_transfer.php?inserted");
                            							   
                            						   }else{
                            						       
                            						       	header("Location: add_transfer.php?failure");
                            						       
                            						       
                            						   }
                            					   }
					                             
	
	 
	
	
 
?>































 <?php include 'headeradmin.php'; ?>
 

 <!---begin of Mobile View Here   only from Digital Forest Team-->
 
       <?php include 'menu.php'; ?>
  
  <!---End of Mobile View Here   only from Digital Forest Team-->
  
 
     
     
     
  
    <div class="container-fluid mt--7">
     <!-- Table -->
      <div class="row">
        <div class="col">
          <div class="card shadow" >
            <div class="card-header border-0">
              <h3 class="mb-0"><a href=""   class="btn btn-danger">ADD TRANSACTION FOR CUSTOMER</a></h3>
            </div>
          
           <div class="card-body">
               
               
               
        
               <?php
if(isset($_GET['inserted']))
{
	?>
    <div class="container-fluid">
	<div class="alert alert-info">
    Transfer Records added . <a href="index.php">HOME</a>!
	</div>
	</div>
    <?php
}
else if(isset($_GET['failure']))
{
	?>
    <div class="container-fluid">
	<div class="alert alert-danger" role="alert">Error</div>
	</div>
    <?php
}
?>

<br />

<div class="container-fluid">

 	
	<form method='post'>
 
        <div class="form-group">
            <label for="name">Email (customer Email)</label>
			<input id="name" name="email" class="form-control" type="text" required />
		 
        </div>
		
		<div class="form-group">
            <label for="name">Reciever/Sender Bank</label>
			<input id="name" name="bank_name" class="form-control" type="text" required />
		
        </div>
		  
		<div class="form-group">
            <label for="name">Reciever/Sender Acc. No</label>
			<input id="name" name="acc_no" class="form-control" type="text" required />
        </div>
        
        	<div class="form-group">
            <label for="name">Sender/Reciver Acc. Name</label>
			<input id="name" name="acc_name" class="form-control" type="text" required />
        </div>
 
        <div class="form-group">
			<label for="acc_no">Amount</label>
			<input id="email" name="amount" class="form-control" type="number" required />
        </div>
 
        
			<input id="website" name="date" class="form-control" type="hidden" required />
      
 
        <div class="form-group">
			<label for="contact">Transfer Status <small>(Successful,Pending,Failed,On-Hold)</small></label>
			<input id="contact" name="status" class="form-control" type="text" required />
        </div>
        
        <div class="form-group">
			<label for="job">SWIFT CODE</label>
			<input id="job" name="swift" class="form-control" type="text"  />
        </div>
		
		<div class="form-group">
			<label for="job">Transfer Type</label>
			<input id="job" name="type" class="form-control" type="text"  placeholder="Credit  or Debit"  required />
        </div>
		
		<div class="form-group">
			<label for="company">Purpose of Transfer</label>
			<input id="company" name="remarks" class="form-control" type="text" required />
        </div>
		
		 <div class="form-group">
            <label for="name">Transaction Date</label>
			<input id="name" name="routing" class="form-control" type="text" value="<?php echo date("h:i A d M Y"); ?>" required />
        </div>
 
         
 
        <table>
            <td colspan="2">
            <button type="submit" class="btn btn-primary" name="btn-save">
    		<span class="glyphicon glyphicon-plus"></span> Save Transaction
			</button>  
            <a href="index.php" class="btn btn-large btn-success"><i class="glyphicon glyphicon-backward"></i> &nbsp; Back to Main Menu</a>
            </td>
        </table>
</form>
</div>
               
               
               
               
               
               
               
          </div>
        </div>
      </div>
     </div>
 
    
       <?php include 'foot.php'; ?>