<?
session_start();
include_once('includes/top.php');
include_once('opendb.php');
$brcode=$_SESSION['brcode'];
$user=$_SESSION['user'];
$level=$_SESSION['level'];
if(strlen($user)<=0)
{
 print "<script> alert('You are not logged in') </script>";
 include("logout.php");
 return;
}
?>

	<link type="text/css" href="includes/style1.css" rel="stylesheet" />
<link href="css/form.css" type="text/css" rel="stylesheet" media="screen" />
<script>
function valid()
{ 
 subOK="false";
 x=confirm("Do you want to save?");
 if(x)
  subOK="true";
   if(subOK=="true")
     return true;
   else
     return false;
} 

function chkey(abc)
{
 yy=abc.value
 if(yy.length>35)
 { 
//   alert('Name exeeds the limit');
//   return;
 }

 if(yy.indexOf('  ')>-1) 
  {
    alert('Multiple space is not allowed');
    abc.value='';
  }
 if(yy.indexOf("'")>-1) 
  {
    alert("\' is not allowed");
    abc.value='';
  }
 if(yy.indexOf('"')>-1) 
  {
    alert("\" is not allowed");
    abc.value='';
  }

if(yy.indexOf("&")>-1) 
  {
    alert("& is not allowed");
    abc.value='';
  }

}
</script>
<br>

<form name='f1' action='' method='POST'><input type=text name='sea' placeholder='Search by A/C Name'> <input type=submit value='Search' name='sealed' ></form><br>
<table cellspacing=1 cellpadding=3 class='report'>
<th>No. <th>Name <th>A/C Name<th>Address <th>Dist <th>State <th> Pin <th>Phone <th>Mobile <th>Cramt<th>Crdays<th>Del
<?
if($_REQUEST['sealed'])
{
    $searchtxt=$_REQUEST['sea'];
    $re=mysqli_query($db,"select * from customer where acname like '%$searchtxt%' order by acname limit 100")or die(mysqli_error($db));   
}
else
{
    $re=mysqli_query($db,"select * from customer order by acname limit 100")or die(mysqli_error($db));
}

$i=1;
while($row=mysqli_fetch_array($re))
{
 print "\n<form method='post' action='editcust.php'>\n<input type=hidden name='code' value='$row[1]'><input type=hidden name='acname' value='$row[5]'>";
 print "\n<tr bgcolor=aliceblue><td>".$i++."</td><td>$row[cname]</td><td>$row[acname]</td><td>$row[addr1]</td><td>$row[dist1]</td><td>$row[state1]</td><td>$row[pin1]</td><td>$row[phone1]</td>";
 print "<td>$row[mob]</td><td>$row[cramt]</td><td>$row[crdays]</td><td>\n<input type=submit value='Edit' name='edit'></td></tr></form>";
}
?>
</table>


