<?
session_start();
include("opendb.php");
if($sv)
{
  $sql="insert into termsmaster (tname) values('$tname')";
 mysqli_query($db,$sql) or die(mysqli_error($db));
}
if($del)
{
  $sql="delete from termsmaster where code='$code'";
 mysqli_query($db,$sql) or die(mysqli_error($db));
}
?>
<title>PSN Telcon</title>
<link rel="stylesheet" href="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>

<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 >> Terms & Conditions</font>

<script>
function valid()
{
 if(document.f1.tname.value.length<=0)
 { alert ('Invalid Terms'); return false;}
}
</script>
<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>TERMS MASTER</td> </tr>
<tr><td align=center bgcolor=white>
<table cellspacing=1 cellpadding=5>
<tr><td>Terms </td><td><textarea name='tname' cols=60 ROWS=10></textarea></td></tr>
<tr><td> <input type=submit value='Save' name='sv'>
</td></tr>
</table>
</td></tr>
</table>
</form>
<?
$result=mysqli_query($db,"select * from termsmaster order by 1");
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 name='f1' action='$PHP_SELF'><input type=hidden name='code' value='$row[0]'>\n<td>".$i++."</td><td>$row[1]</td><td><input type=submit value='Del' name='del'></td></form></tr>";
}
?>
</table>
</td></tr></table>
