<? 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($del)
{
$rr2=mysqli_query($db,"select * from newtrans1 where chno='$chno' and brcode='$brcode'");
  if(mysqli_num_rows($rr2)>0)
{
 print "<script> alert('Cannot be deleted.Pls empty transactions')</script>";
return;
}
  mysqli_query($db,"delete from schemenew where chno='$chno'")or die('err'.mysqli_error());
 print "<script>document.location='scheme2.php'</script>";

}




?>
<script>

function valid()
{

submitOK="true";

 /*if(document.f1.scheme.selectedIndex<=0)
 {
  submitOK="false";
   alert('Invalid Scheme');   
 }
*/
if(document.f2.chnos.selectedIndex<=0)
 {
  submitOK="false";
   alert('Invalid Chasis ');
  }

if(submitOK=="true")
   return true;
  else
   return false;
 
 

}
</script>

<style>
body,td{font-family:'arial narrow';letter-spacing:1;font-size:13}
th{background-color:c1d7bb;font-size:13}
.mnu{margin-left:5}
</style>
<center>
<form name='f1' action='schemnewtrans.php' method='post' > 
<table>
<th colspan=4>FREE SERVICE SCHEME </TH>

<tr>
<td><font color=red>Schemelist </td><td><select name='schemelist'><option>Select</option>

<?
 $re=mysqli_query($db,"select * from schememaster order by sname");
 while($row=mysqli_fetch_row($re))
 {
   print "<option>$row[1]</option>";
 }
?>
</select></td><td></td>
<th colspan=4><input type=submit value='show' name='show'>

</tr>
</table>
</form>
<form name='f2' action='schemnewtrans1.php'  onSubmit="return valid()"> 
<table>

<tr>
<td><font color=red>chasis nos </td><td><select name='chnos' style=" width:245"><option>Select</option>
<?
if($show)
{


$re=mysqli_query($db,"select chno from schemenew where brcode='$brcode' and schemename='$schemelist' and chno not in (select chno from scheme2011extdcmpltd) order by chno");
while($row=mysqli_fetch_array($re))
{

   print "<option>$row[0]</option>";
 }

}

?>
</select>

</td><td><input type=submit value='Next->' ></td>

</td></tr>
</table>
</form>
<center>

