	<?php include 'header-link.php' ?>
    <?php 
            
    // Check if the form is submitted
    if ($_SERVER['REQUEST_METHOD'] == 'POST') {
        $BankName = $_POST['BankName'];
        $AcName = $_POST['AcName'];
        $AcNo = $_POST['AcNo'];
        $BranchName = $_POST['BranchName'];
        $Address = $_POST['Address'];
        $Country = $_POST['Country'];
        


        // Insert the new offer data into the database
        $insertSql = "INSERT INTO bank_info (bank_name, acc_name, acc_no, branch_name, address,country) 
                                            VALUES (?, ?, ?, ?, ?, ?)";
        
        $stmt = $con->prepare($insertSql);
        $stmt->bind_param("ssssss", $BankName, $AcName, $AcNo, $BranchName,$Address, $Country);

        if ($stmt->execute()) {
            $success_message = "New Bank added successfully.";
        } else {
            $error_message = "Error: " . $stmt->error;
        }

        $stmt->close();
    } 
    ?>


    <main>
	
        <section>   
			<div class="container">
				<div class="row justify-content-center">
					<div class="col-md-6">
						<div class="card custom-card">
							<div class="card-body">
								<h6 class="card-title text-center d-block"> Add New Offer </h6>
                                        <?php if (!empty($success_message)): ?>
                                            <div class="alert alert-success"><?php echo $success_message; ?></div>
                                            <?php endif; ?>
                                            <?php if (!empty($error_message)): ?>
                                                <div class="alert alert-danger"><?php echo $error_message; ?></div>
                                        <?php endif; ?>
								
									<form class="form" action="" method="POST">

                                        <div class="mb-3">
                                            <label class="form-label"> Bank Name </label>
                                                <input type="text" name="BankName" class="form-control" placeholder="Enter Bank Name">
                                                
										</div>

                                        <div class="mb-3">
                                            <label class="form-label"> Account Name </label>
                                                <input type="text" name="AcName" class="form-control" placeholder="Enter Account Name">
                                                
										</div>

                                        <div class="mb-3">
                                            <label class="form-label"> Account No </label>
                                                <input type="text" name="AcNo" class="form-control" placeholder="Enter Account No ">
                                                
                                        </div>

                                        <div class="mb-3">
                                            <label class="form-label"> Branch Name </label>
                                                <input type="text" name="BranchName" class="form-control" placeholder="Enter Branch Name">
                                                
                                        </div>

										<div class="mb-3">
                                            <label class="form-label"> Address </label>
                                                <input type="text" name="Address" class="form-control" placeholder="Enter Address ">
                                                
										</div>

                                        <div class="mb-3">
                                            <label class="form-label"> Country </label>
                                                <input type="text" name="Country" class="form-control" placeholder="Enter Country Name">
                                                
										</div>

										<button type="submit" class="btn custom-button"> Save  </button>
									</form>
									
							</div>
						</div>
					</div>
				</div>
			</div>
		</section>
		

		
    </main>

    
</body>
</html>
