<? session_start();
if(strlen($brcode)<=0)
{
 print "<script> alert('Session timed out'); parent.document.location='../ind.php'; </script>";
 return;
}
include("../opendb.php");
if($edit)
{
 if(strlen($finname)<=0)
  {
     print "<script> alert('In sufficient entry'); history.back(1);  </script>";
     return;
  }

 $sql="update fin_master set finname='$finname',addr1='$addr1',addr2='$addr2', city='$city', dist='$dist', stat='$stat',pin='$pin', phone1='$phone1', phone2='$phone2', email='$email' where code='$code' and branch='$brcode'";
 mysqli_query($db,$sql)or die(mysqli_error());
 include("fine.php");
 return;
}
$re=mysqli_query($db,"select * from fin_master where code='$code' and branch='$brcode'");
$ro=mysqli_fetch_row($re);
?>

<style>
body,td{font-family:'arial narrow';letter-spacing:1;}
tr{background-color:c1d7bb}
.mnu{margin-left:5}
</style>
<body bgcolor='ivory'>

<CENTER>
<BR>
<FORM ACTION='<?print $PHP_SELF?>' METHOD='POST'>
<input type=hidden name='code' value='<?print $code?>'>
<table cellspacing=1 cellpadding=1 bgcolor=green>
<tr><td align=center>
<table>
<tr><td colspan=2 align=center><STRONG>EDIT FINANCIER  MASTER</TD></TR>
<tr><td><font color='gray'>Name </td><td>
  <input type=text name='finname' readonly size=40 value='<?print $ro[1]?>' onKeyDown=chkey(this) style={color:gray}>
 </td></tr>
<tr><td>Address1 </td><td><input type=text name='addr1' size=40 value='<?print $ro[2]?>'></td></tr>
<tr><td>Address2 </td><td><input type=text name='addr2' size=40 value='<?print $ro[3]?>'></td></tr>
<tr><td>City </td><td><input type=text name='city' size=40 value='<?print $ro[4]?>'></td></tr>
<tr><td>District </td><td><select name='dist'>
<option><?print $ro[5]?>
<?
$re=mysqli_query($db,"select * from dist_master where brcode='$brcode' order by dist");
while($row=mysqli_fetch_row($re))
{
 print "<option>$row[1]</option>";
}
?>
 </select></td></tr>
<tr><td>State </td><td><input type=text name='stat' size=40 value='<?print $ro[6]?>'></td></tr>
<tr><td>Pin No </td><td><input type=text name='pin' size=40 value='<?print $ro[7]?>'></td></tr>
<tr><td>Phone1 </td><td><input type=text name='phone1' size=40 value='<?print $ro[8]?>'></td></tr>
<tr><td>Phone2 </td><td><input type=text name='phone2' size=40 value='<?print $ro[9]?>'></td></tr>
<tr><td>Email_id </td><td><input type=text name='email' size=40 value='<?print $ro[10]?>'></td></tr>
<TR><TD COLSPAN=2 ALIGN=CENTER><INPUT TYPE=SUBMIT NAME = 'edit' VALUE='  SAVE  '> <input type=button value='  CANCEL  ' onClick=history.back(1);> </TD></TR>

</table>
</td></tr>
</table>
</FORM>
<script>
function chkey(abc)
{
 yy=abc.value
 if(yy.indexOf('  ')>-1) 
  {
    alert('Multiple space is not allowed');
    abc.value='';
  }
}
</script>
