<? session_start(); ?>
<link rel="stylesheet" href="style.css" type="text/css" />
<?
$edit = $_REQUEST['edit'];
$code = $_REQUEST['code'];
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 brname")or die(mysqli_error($db));
?>
<table border=0  cellspacing=2 cellpadding=5>
<th>No.<th>Branch Name <th>Br. Code <th>Address <th>City <th>State <th>Phone <th>Type <th>VECV Pur<th>Local Pur<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[brstate]</td><td>$row[5]</td>";
print "<td>$row[brtype]</td><td>$row[vecvpur]</td><td>$row[localpur]</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>
