<?php
	require_once('include/config.php');
    require_once('include/startup.php');
    include('include/header.php');
    
    $alltables = new AllTables();
    
	$selected_members = $_POST['selected_members'];
	$selected_count = count($selected_members);	
	
	if($selected_count > 0)
	{
	    for($i=0;$i<$selected_count;$i++)
     	{
     		if($i == 0)
     		{
     			$selected_membersid = $selected_members[0];	 			
     		}
     		else 
     		{
    			$selected_membersid .= ','.$selected_members[$i];	 			
     		}
     	}
    	 	
     	$where_condition = " id in ( ".$selected_membersid.")";
    	$sql ="select Email from visitor_reg
    			where $where_condition
    			order by companyname asc";
        $invoicelist = $alltables -> getInfo('',$sql);
        $rowcount = count($invoicelist);
    		
    	for($i=0;$i<$rowcount;$i++)
    	{
    	    if($i == 0)
    	 	{
    			$email = $invoicelist[0]['columnname'];
    	 	}
    	 	else 
    	 	{
    	 		$email .= ','.$invoicelist[$i]['columnname'];
    	 	}
    	}
	}
		
require("create_email_msg1.html");
include('include/footer.php');
?>