<?php 
include ('config.php');
$select_query=mysqli_query($conn,"select * from tbl_statement where  emp_acc='".$_SESSION['emp_accno']."'");
$result=mysqli_fetch_array($select_query);

if(isset($_REQUEST['submit']))
{
  $name =$result['emp_name'];
  $remarks=$_REQUEST['remarks'];
  
  $subject="Employee Remarks from $name";
  $message='<table border="1" align="center" cellpadding="5" cellspacing="0" bordercolorlight="#000000">
  <tr>
    <td><table width="590"  border="0" align="center" cellpadding="5" cellspacing="0">
      <tr>
        <td colspan="6" align="center" bgcolor="#FFCC00"><h3> Employee Remarks </h3></td>
      </tr>
	   
	   <tr>
        <td width="8%">1.</td>
        <td width="35%" align="left"> Name</td>
        <td width="3%">:</td>
        <td width="54%"><div align="left">'.$name.'</div></td>
      </tr>
	   <tr>
        <td width="8%">2.</td>
        <td width="35%" align="left">Remarks</td>
        <td width="3%">:</td>
        <td width="54%"><div align="left">'.$remarks.'</div></td>
      </tr>
	</table></td>
  </tr>
 </table>';
//echo $email_to.$subject.$message;exit;
		$headers  = "MIME-Version: 1.0\r\n";
  		$headers .= "Content-type: text/html; charset=utf-8\r\n";
  		//$headers .= "To: $email <$email>\r\n";
  		$headers .= "From: $name <mp@impal.net>\r\n";		
		$to='testcrb@gmail.com,estb1@impal.net,sram@impal.net,mrsriram@impal.net';
		$m=mail($to,$subject,$message,$headers);
		
		if($m)
		{
		echo '<script language="javascript">alert("Your Message Posted Successfully");</script>';
		echo '<script language="javascript">window.location.href="homepage.php";</script>';
		}
		else
		{
		echo '<script language="javascript">alert("Error On Message Sent");</script>';
		echo '<script language="javascript">window.history.back();</script>';
		}
 }
?>