<?php include("sass/header_links_only.php");?>
         <?php 
		 
		 $bank_id =$_REQUEST['id'];

$result = mysqli_query($connection,"SELECT * FROM bank_name WHERE bank_id  = '$bank_id'");
$test = mysqli_fetch_array($result);

				$bank_name=$test['bank_name'];
				$balance=$test['balance'];
				$balance_bn_view = $balance;
				$ac_no=$test['ac_no'];
if(isset($_POST['submit']))
{	
	$bank_id =$_POST['bank_id'];
	$bank_name = $_POST['bank_name'];
	$ac_no = $_POST['ac_no'];
	$balance = $_POST['balance'];
	$balance = $balance;

	mysqli_query($connection,"UPDATE bank_name SET bank_name ='$bank_name', ac_no ='$ac_no', balance ='$balance' WHERE bank_id = '$bank_id'")
				or die(mysqli_error()); 
				
				
					mysqli_query($connection,"UPDATE transaction SET debit ='$balance' WHERE date = '2014-01-02' and bank_id = '$bank_id'")
				or die(mysqli_error()); 
				
				
	header("location: lc_edit_bank_success.php");		
}
		 
		 
		 
		 
		 ?>
         
        <div class="wrapper row-offcanvas row-offcanvas-left">
            <!-- Left side column. contains the logo and sidebar -->

            <!-- Right side column. Contains the navbar and content of the page -->
               <aside class="right-side">
              
                 <section class="content">
                 	 <div class="row">
                        <div class="col-md-6">
                 <!---Main Content--->
                 
                 			<form role="form"  action="<?php echo "https://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']; ?>" method="post">
                              <?php
							if (!empty($errMsg))
							{echo "<div class='alert alert-warning alert-dismissible' role='alert'>$errMsg";
							echo "<button type='button' class='close' data-dismiss='alert'><span aria-hidden='false'>&times;</span><span class='sr-only'>		Close</span></button>
                        </div>";}
                        ?>
                                    <div class="box-body">
                                        <div class="form-group">
                                             <label for="exampleInputEmail1">Bank Name</label>
                                            <input type="hidden" name="bank_id" value="<?php echo $bank_id;?>" />
                                            <input type="text" class="form-control" name="bank_name" value="<?php echo $bank_name;?>" id="" placeholder="পন্যের নাম লিখুন">
                                        </div>
                                        <div class="form-group">
                                             <label for="exampleInputEmail1">Account Number</label>
                                            <input type="text" class="form-control" name="ac_no" value="<?php echo $ac_no;?>" id="" placeholder="লিখুন">
                                        </div>
                                        <div class="form-group">
                                           <label for="exampleInputEmail1">Current Balance</label>
                                            <input type="text" class="form-control" name="balance" value="<?php echo $balance_bn_view;?>" id="" placeholder="প্রতি কেজি কমিশন লিখুন">
                                        </div>
                                    </div><!-- /.box-body -->

                                    <div class="box-footer">
                                        <button type="submit" name="submit" class="btn btn-primary">Submit</button>
                                    </div>
                                </form>
                            
                 		</div>
                    </div>
                 
                 
                 </section>
                </aside>
                <!-- /.right-side -->
        </div><!-- ./wrapper -->


        <!-- jQuery 2.0.2 -->
         <?php include("sass/footer_for_datepicker_and_datatable.php");?>

    </body>
</html>