<?
session_start();
include("opendb.php");
if($sv)
{
 if(strlen($engine)<=1)
   return;
 $code=substr(time(),7,3).date(s);
 $sql="insert into enginemaster values('$code','$engine')";
 mysqli_query($db,$sql) or die('error:'.mysqli_error($db));
}
if($del)
{
  $sql="delete from enginemaster where code='$code'";
 mysqli_query($db,$sql) or die(mysqli_error($db));
}
?>
<title>PSN Telcon</title>
<link rel="stylesheet" href="includes/style.css" type="text/css" />
<script type="text/javascript" src="scripts/jquery-latest.js"></script>
<link type="text/css" href="includes/style1.css" rel="stylesheet" />
<link rel="stylesheet" href="css/form.css" type="text/css" />
<script type="text/javascript">
        $(function() {
          if ($.browser.msie && $.browser.version.substr(0,1)<7)
          {
			$('li').has('ul').mouseover(function(){
				$(this).children('ul').show();
				}).mouseout(function(){
				$(this).children('ul').hide();
				})
          }
        });        
    </script>

<script>
function valid()
{
 if(document.f1.config.value.length<=0)
 { alert ('Invalid Configuration'); return false;}
}
</script>
<body background="back_ground.jpg">
<?php include('logo2.php'); ?>

<?php include('includes/top.php'); ?>
<br>

<table class="container"><tr><td>
<font style="font-family: 'Trebuchet MS',Verdana,Helvetica,sans-serif; font-size:15px;">  &nbsp;&nbsp;Master >> <a href="mach_menu.php" style="text-decoration:none;">Machine</a> >> Engine Master</font>
<br>
<CENTER>
<form name='f1' action='<?print $PHP_SELF?>' onSubmit="return valid()"> 
<table cellspacing=1 cellpadding=5 class='form'>
<tr><td align=center colspan=2 bgcolor='green'><font color=white><b>E N G I N E &nbsp; M A S T E R</td> </tr>
<tr ><td>Engine </td><td><input type=text size=50 name='engine'></td></tr>
<tr><td colspan=2 align=center><input type=submit value='Save' name='sv'></td></tr>
</table>
</form>

<?
$result=mysqli_query($db,"select * from enginemaster order by engine");
print "<table cellspacing=1 cellpadding=5 class='report'>";
print "<th>No <th>Name  <th>Del";
$i=1;
while($row=mysqli_fetch_row($result))
{
 print "\n<tr><form action='$PHP_SELF'><input type=hidden name='code' value='$row[0]'><td>".$i++."</td><td>$row[1]</td><td><input type=submit value='Del' name='del'></td></form></tr>";
}
?>
</table>
</td></tr></table>
