<?
session_start();
include_once('opendb.php');
$brcode=$_SESSION['brcode'];
$user=$_SESSION['user'];
if(strlen($brcode)<=0)
{
 print "<script> alert('Session timed out'); parent.document.location='inde.php'; </script>";
 return;
}
$prod=$_REQUEST['prod'];

?>
<div id=div1>
<?
$i=1;
print "<table border=1 class=report><th>Sl no<th>Group<th>Subgrop<th>Edit<th>Del";
if($prod==1)
{
$sql="select * from subgroupmaster";

}
else
{
$sql="select * from subgroupmaster where gname='$prod'";
}
$res=mysqli_query($db,$sql);
while($row=mysqli_fetch_array($res))
{
?>
<tr>
<td><? echo $i++; ?></td><td><? echo $row[gname] ?></td><td><? echo $row[subname] ?></td>
<td><input type=button value='Edit' onClick=window.open('editsubgr.php?code=<? echo $row[id] ?>',menubar=false,resizable=false)></td><td><input type=button value='Del' name='del' onClick=delfun('<? echo $row[id] ?>')></td>
</tr>
<?
}
?>
</table>
</div>
