<?php
include('../include/config.php');
$grd=$_POST['grd'];
if($grd=='All')
{
$query=mysqli_query($con,"select * from pupils where Contact !='' AND Status='Active' ORDER BY Claz ASC");
$cnt=1;
while($row=mysqli_fetch_array($query))
{
?>  
<tr class="row-selectt">
<td><?php echo $cnt; ?></td>
<td><?php echo $row["Names"].'('.$row["AdmNo"].')'; ?></td>
<td><?php echo $row["Claz"]; ?></td>
<td><?php echo $row["PName"]; ?></td>
<?php
$tel=$row["Contact"];
$one=substr($tel, 0, 1);
if($one !='0')
{
 $tel='0'.$tel; 
}
$tel=substr($tel, 0, 10);
?>
<td class="alert-success"><?php echo $tel; ?></td>
<td>
<input type="hidden" class="parephone" value="<?php echo $tel; ?>" />
<input type="hidden" class="parepid" value="<?php echo $row["count"]; ?>" />
<!--input type="checkbox" name='checkbox[$rowid]' value="<?php echo $row["count"]; ?>"-->
</td>
</tr>
<?php  
$cnt=$cnt+1;
} 
   
}else
{
$query=mysqli_query($con,"select * from pupils where Contact !='' AND Status='Active' AND Claz='$grd' ORDER BY Names ASC");
$cnt=1;
while($row=mysqli_fetch_array($query))
{
?>  
<tr class="row-selectt">
<td><?php echo $cnt; ?></td>
<td><?php echo $row["Names"].'('.$row["AdmNo"].')'; ?></td>
<td><?php echo $row["Claz"]; ?></td>
<td><?php echo $row["PName"]; ?></td>
<?php
$tel=$row["Contact"];
$one=substr($tel, 0, 1);
if($one !='0')
{
 $tel='0'.$tel; 
}
$tel=substr($tel, 0, 10);
?>
<td class="alert-success"><?php echo $tel; ?></td>
<td>
<input type="hidden" class="parephone" value="<?php echo $tel; ?>" />
<input type="hidden" class="parepid" value="<?php echo $row["count"]; ?>" />
<!--input type="checkbox" name='checkbox[$rowid]' value="<?php echo $row["count"]; ?>"-->
</td>
</tr>
<?php  
$cnt=$cnt+1;
}
}
?>
