<? session_start(); ?>
<style>
body,td{font-family:'arial narrow';letter-spacing:1;}
th{background-color:c1d799}
.mnu{margin-left:5}
</style>
<?
if($edit)
{
 print "<script> window.open('editbr.php?code=$code',menubar=false, resizable=false)</script>";
}

?>

<body bgcolor=fcfff1>
<font color=green>
<h3>List of Branches</h3></font>
<hr bgcolor=red>
<?
include("../opendb.php");
$result=mysqli_query($db,"select * from branch order by brcity")or die(mysqli_error());
?>
<table border=0  cellspacing=2 cellpadding=5>
<th>No.<th>Branch Name <th>manager <th>Address <th>City <th>Phone <th>Type <th>Action
<?
$i=1;
while($row=mysqli_fetch_array($result))
{
 print "\n<form action='$PHP_SELF'> <input type=hidden name='code' value='$row[0]'>";
 print "\n<tr bgcolor='c1d7bf' onMouseOver=bgColor='Pink'; onMouseOut=bgColor='c1d7bf'; ><td>".$i++."</td><td>$row[1]</td><td>$row[2]</td><td>$row[3]</td><td>$row[4]</td><td>$row[5]</td>";
print "<td>$row[brtype]</td>";
 print "<td><input type=submit name='edit' value='Edit'> \n<input type=button name='del' value='Delete' onClick=javascript:del1('$row[0]','$row[1]')></td></form> </tr>";
}
?>
</table>
<script>
function del1(a,b)
{
 x=confirm("Do you want to delete the branch '"+b+"'");
if(x)
 document.location='delbranch.php?code='+a;
}
</script>
