<?
session_start();
if(strlen($brcode)<=0)
{
 print "<script> alert('Invalid Login'); parent.document.location='ind.php' </script>";
 return;
}
include("../opendb.php");
include("../test.php");

if($save)
  {
  mysqli_query($db,"insert into warranty_mast values('$desc','$brcode','')");
  print "<script>alert('Data has been saved');document.location='warr_master.php';</script>";
  }




?>
<link rel="stylesheet" href="../style.css" type="text/css" />
<style>
body,td{font-family:arial narrow;font-size:14}
th{background-color:silver}
</style>
<body>
<center>
</br>
<form name='f1' action='<? echo  $PHP_SELF;?>'>
<table align='center' style="border-collapse:collapse;">
<tr><th colspan='2'>Warranty Master</th></tr>
<tr><td>Description</td><td><textarea name='desc' cols=55></textarea></td></tr>
<tr><th colspan='2'><input type='submit' name='save' value='Save'/></th></tr>
</table>
</form>
<h2>Report</h2>
<table align='center' style="border-collapse:collapse;">
<tr><th>Sl.No</th><th>Desc</th><th>del</tr>
<?
$i=1;
 $row=mysqli_query($db,"select * from warranty_mast where brcode='$brcode' ");
 while($row1=mysqli_fetch_array($row))
  {
  print"<tr><td>".$i++."</td><td>$row1[0]</td><td>";
?>
<input type='button' name='del' value='Del' onclick="del(<? echo $row1[2]; ?>)"/></td></tr>
<?
  }
  ?>
</table>
<script>
function del(str)
{
 	var r=confirm("Do You Want To Delete!")
	if (r==true)
 	 {
 	 document.location='del_warr.php?id='+str;
 	 }
	else
 	 {
 	 return false;
 	 }
}
</script>


