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

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

if($save)
{

$sql="update worktype_master set worktype='$work', jobtype='$job' where id='$code'";
mysqli_query($db,$sql) or die('Insert Err:'.mysqli_error($db));

print "<script> opener.document.location='worktype.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 WORKTYPE MASTER</th>
<tr><td>Work type</td><td><input type=text name='work'  size=20 value='<?print $rerow[worktype]?>'></td></tr>
<tr><td>Select Job type</td><td><select name='job' ><option><?print $rerow[jobtype]; ?></option>

 <?
 $qry=mysqli_query($db,"select jobtype from jobtype_master where brcode='$brcode'");
 while($qry1=mysqli_fetch_row($qry))
 {
  print "<option>$qry1[0]</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>
