<?
session_start();
include("../opendb.php");
include("../test.php");

$re=mysqli_query($db,"select * from groupmaster where code='$code'");
$rerow=mysqli_fetch_array($re);

if($save)
{

$sql="update groupmaster set gname='$gname',tax='$tax' where code='$code'";
mysqli_query($db,$sql) or die('Insert Err:'.mysqli_error());

print "<script> opener.document.location='grmaster.php'; window.close()</script>";
return;
}
//$re=mysqli_query($db,"select * from configmaster");
//$row=mysqli_fetch_array($re);
?>
<link rel="stylesheet" href="../style.css" type="text/css" />
<style>
th{background-color:steelblue;color:white}
</style>
<script>
this.resizeTo(750,170);
function valid()
{
 
 /*if(document.f1.tax.value.length<=0)
 {
   alert("Invalid Tax.");
   document.f1.tax.focus();
   return false;
 }*/

}
</script>

<center>
<table cellspacing=1 cellpadding=1 bgcolor=black>
<tr><td align=center bgcolor='white'>
<form name='f1' action='<?print $PHP_SELF?>' method='post' onSubmit="return valid()">
<input type=hidden name=code value='<?print $code?>'>
<table cellspacing=1 cellpadding=3 width='350'>
<th colspan=2><font size=3>EDIT GROUP MASTER</th>
<tr><td>Group Name</td><td><input type=text name='gname'  size=20 value='<?print $rerow[gname]?>'  readonly></td>
    </tr>
<tr><td>Tax</td><td><select name='tax'  size=1>
<option><?print $rerow[tax]?></option>
<?
$tax=mysqli_query($db,"select * from taxmaster");
while($taxrow=mysqli_fetch_array($tax))
{
print "<option>$taxrow[tax]</option>";
}
?>
</select>
</td>
    </tr>

<th colspan=2><input type=submit value='Save' name='save'> <input type=button value='Cancel' onClick=window.close()></td></tr>
</table>
</form>
</td></tr>
</table>
