<select name="recipient[]" class="select2 form-control select2-multiple" multiple="multiple" multiple data-placeholder="Choose ...">
<?php
$sql = mysql_query("SELECT * FROM `users` ");
while ($result = mysql_fetch_array($sql))
{
echo
'<option value="'.$result['email'].'">'.$result['email'].'</option>';
}
?>
$subject = trim($_POST['subject']);
$users_group_list = $_POST['recipient'];
$text_email=trim($_POST['text_email']);
$users_info = mysql_query("SELECT * FROM `users` WHERE email='".$users_group_list."'");
while ($result_user_info = mysql_fetch_array($users_info))
{
echo $result_user_info['name'];
echo $result_group_info;
echo $subject;
echo $message;
}
$in = str_repeat('?,', count($users_group_list) - 1) . '?';
$sql = "SELECT * FROM `users` WHERE email IN ($in)";
$stmt = $mysqli->prepare($sql);
$stmt->bind_param(str_repeat('s', count($array)), ...$users_group_list);
$Stmt->execute();
$result = $stmt->get_result();
$data = $result->fetch_all(MYSQLI_ASSOC);