<link rel="stylesheet" href="style.css" type="text/css" />
<?
include("opendb.php");
 if($submit)
  {
    $sql="update labitem set grpcode='$labgrp',itemname='$item',amt='$amt' where itemcode='$code'";
	mysqli_query($db,$sql) or die(mysqli_error());
   include("labmas.php");
    return;
}
$lab_sql="select a.grpcode,a.itemcode,a.itemname,a.amt,b.gname from labitem a,labgrp b  where a.grpcode=b.gcode and a.itemcode='$code'";

$lab_result=mysqli_query($db,$lab_sql) or die(mysqli_error());
$lab_row=mysqli_fetch_array($lab_result);
?>
<center><p>&nbsp;<p>&nbsp;<p>&nbsp;
<form action='<?print $PHP_SELF?>'>
<input type=hidden name=code value='<?print $code?>'>
<table cellspacing=1 cellpadding=1 bgcolor=D1D0AF>
<tr><td align=center bgcolor=''><B>EDIT LAB ITEM</TD></TR>
<TR><TD ALIGN=CENTER>
<table border=0 BGCOLOR='EBF0DB'>
<tr><td>New Item </td><td>
	<input type=text name='item' size=20 value='<?print $lab_row[itemname]?>'></td>
<td>Under Group</td><td><select name="labgrp">
<option value='<?print $lab_row[grpcode]?>'> <?print $lab_row[gname]?></option>
<?
$result=mysqli_query($db,"select * from labgrp order by gname");
while($row=mysqli_fetch_array($result))
{
 print "\n<option value='$row[gcode]'>$row[gname]</option>";
}
?>
</select> </td>
<tr>
<td>Charge (Rs.)</td><td><input type=text name='amt' size=5 value='<?print $lab_row[amt]?>'></td>

<tr>
<td colspan=4 align=right bgcolor=D1D0AF>
<input type=button value='Cancel' onClick=history.back(1)> <input type=submit NAME='submit' value='   Update   '></td></tr>
</table>
</form>
