<? 
session_start();
if(strlen($brcode)<=0)
{
 print "<script> alert('Session timed out'); parent.document.location='../ind.php'; </script>";
 return;
}
include("../opendb.php");
include("../test.php");
if($save)
{
 $sql="update drv_master set name='$na',branch='$br',cnt='$cnt' where code='$code' and brcode='$brcode'";
 mysqli_query($db,$sql); 
print "<script> document.location='driver.php' </script>";
}

$re=mysqli_query($db,"select * from drv_master where code='$code'");
$row=mysqli_fetch_array($re);
?>
<link rel="stylesheet" href="../style.css" type="text/css" />
<body bgcolor='ivory'>
<center>
EDIT DRIVER MASTER<BR>
<FORM ACTION='<?PRINT $PHP_SELF?>'>
<input type=hidden name=code value='<?print $code?>'>
<table>
<tr><td>Name </td><td><input type=text name='na' value='<?print $row[1]?>'> </td></tr
<tr><td>Branch </td><td>
<select name='br'>
<?
$sql="select * from br_master where code='$row[branch]'";
print $sql;
$rr=mysqli_query($db,$sql)or die(mysqli_error());
$brrow=mysqli_fetch_array($rr);
print "<option>$brrow[brname]</option>";
$re=mysqli_query($db,"select * from br_master where brcode='$brcode'")or die(mysqli_error());
while($row1=mysqli_fetch_row($re))
{
 print "\n<option value='$row1[0]'>$row1[1]</option>";
}
?>
</select>
</td></tr
<tr><td>Name </td><td><input type=text name='cnt' value='<?print $row[3]?>'> </td></tr>
<tr><td colspan=2 align=center><input type=submit value='Save' name='save'> 
<input type=button value='Cancel'onClick=history.back(1)> </td></tr>
</table>
</form>
