<?php
defined("BASEPATH") or exit("No direct access allowed");
if( isset( $_REQUEST['aksi'] )){
		$aksi = $_REQUEST['aksi'];
		switch($aksi){
			case 'listpesan':
				include 'listpesan.php';
		}
} else { 
 
?>
<div class="card-body">            
    <div class="container">
<form action="index.php?page=pesanauto&aksi=listpesan" method="post">
<p><label>Pilih Grup</label><select name="grup" class="form-control" id="cari">
<?php
$query = mysqli_query($con,"SELECT id,nama FROM grup");
if (mysqli_num_rows($query) > 0) {
	while ($grup = mysqli_fetch_array($query,MYSQLI_ASSOC)) {
	    
	    $query2 = mysqli_query($con,"SELECT count(ID) FROM champ WHERE grup = '$grup[id]'");
               $status = mysqli_fetch_array($query2,MYSQLI_NUM);
               $jml5 = $status[0];
               
		echo '<option value="'.$grup['id'].'">'.$grup['nama'].' (Grup '.$grup['id'].') '.$jml5.' Pesan Auto </option>';
	}
}
?>
</select>
<input class="btn btn-secondary btn-border" type="submit" name="pilih" value="Pilih Grup"/></p>
</form>
</div></div>
<?php
}
?>