<? session_start();

include("../opendb.php");
 if(strlen($sname)<=0)
  {
     print "<script> alert('In sufficient entry'); history.back(1);  </script>";
     return;
  }

 $code=substr($sname,0,3).substr(time(),7,3); 
 $code=str_replace(' ','-',$code);

 $sql="insert into townmaster values('$code','$sname','$brcode')";
 mysqli_query($db,$sql) or die(mysqli_error());
 print "<font color='Green'> Data has been saved</font>";
include("town.php");
?>
