<?
include_once("../include/main.inc.php");
check_session('MyCpanel','index.php');
$table_name="mailer_list";
$table_name1="member_tbl";
$table_name2="mass_mail";
$res=getResult($table_name," where mailer_id='$mailer_id' and databasestatus='Y'");
$mailer_country=$res['country']; 
$member_Type=$res['memberType'];
$keyword=$res['keywor'];

if($_POST['action']=="Activate"){
	
	for ($x=0; $x < sizeof($_POST['cid']); $x++){
		$dataRes=$_POST['cid'];
		
		$mailres=getResult("newsletter_member"," where id='$dataRes[$x]'");
		

if($mailres['memberID']=='') {
	
    $sql=db_query("insert into mass_mail set mailerID='$mailer_id', email='$mailres[email]', memberName='$mailres[name]', memberID='$dataRes[$x]',status='N'");
	
}
	}
	$_SESSION['session_message']='Selected record(s) activated successfully.';

}



?>

<table border="1">

<form name="" method="post" action="" >
<tr><td colspan="3"><input type="submit" name="action" value="Activate"  onclick="return chkactivate();" class="button"> </td></tr>
 <?php
 $query=mysqli_query($GLOBALS['dbconn'],"select * from newsletter_member");
 while ($row = mysqli_fetch_array($query)) {
 ?>
 <tr><td><input type="checkbox" name="cid[]" value="<?=$row['id']?>" checked/></td><td><?php echo $row['name']; ?></td><td><?php echo $row['email']; ?></td></tr>
 <?php
 }
 ?>
<tr><td colspan="3"><input type="submit" name="action" value="Activate"  onclick="return chkactivate();" class="button"> </td></tr>
</form>
 </table>
