<?php
session_start();
if(!isset($_SESSION['emailadd'])){
 header("Location: index.php");
}

include 'connect.php';
include("header.php");
include("footer.php");
include("nav.php");



?>


<main>
<head>
	<title>Senarai Akaun</title>
	<style>
		table {
			border-collapse: collapse;
			width: 100%;
		}
		th, td {
			padding: 8px;
			text-align: left;
			border-bottom: 1px solid #ddd;
		}
		tr:hover {
			background-color: #f5f5f5;
		}
		th {
			background-color: #333;
			color: white;
		}
	</style>
</head>
<body>
	<h2>Senarai Akaun</h2>
	<table>
		<thead>
			<tr>
				<th>No Akaun</th>
				<th>Nama Pemegang Akaun</th>
				<th>Maklumat Terperinci</th>
			</tr>
		</thead>
		<tbody>
			<?php

				// Query database to get clientregno and custname
				$sql = "SELECT accno, accholder, detail FROM bankacc";
				$result = mysqli_query($conn, $sql);

				// Output data of each row
				while($row = mysqli_fetch_assoc($result)) {
					echo "<tr>";
					echo "<td>" . $row["accno"] . "</td>";
					echo "<td>" . $row["accholder"] . "</td>";
					echo "<td>" . $row["detail"] . "</td>";				
					echo "</tr>";
				}

				mysqli_close($conn);
			?>
		</tbody>
	</table>
</body>

<form method="get" action="accbank.php">
  <button type="submit" class="add-data-button">Tambah Akaun</button>
</form>
</main>
