<?php // Configuration variables
session_start();
include 'dbc.php';


$userid=$_SESSION["userid"];
$complain=$_POST["remarks"];
$date=$_POST["date"];
$status=$_POST["status"];
$class_name=$_POST["class_name"];
$sql = "SELECT * FROM attendence where date='$date' and class_name='$class_name' and status='$status' and user_id='$userid'";
$result1=$conn->query($sql);
    
  while($test = $result1->fetch_assoc())
{
 $std_name=$test['stdname'] ;
				
				$cell_1=$test['cell'] ;
				
	$type = "xml"; 
$id = "rchalliedch"; 
$pass = "classicgroup786786"; 
$lang = "English"; 
$mask = "Allied C.G";    
// Data for text message 
$to = $cell_1; 
$message =  $std_name . "<br>:" . $complain; 
$message = urlencode($message); 

// Prepare data for POST request 
$data = "id=".$id."&pass=".$pass."&msg=".$message."&to=".$to."&lang=".$lang."&mask=".$mask."&type=".$type;   
// Send the POST request with cURL 
$ch = curl_init('http://www.outreach.pk/api/sendsms.php/sendsms/url'); 
curl_setopt($ch, CURLOPT_POST, true); 
curl_setopt($ch, CURLOPT_POSTFIELDS, $data); 
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); 
$result = curl_exec($ch); 
//This is the result from Outreach 

curl_close($ch); 
	

	 }
	echo "Message Send";

 

?> 
<a href="Attendance_Sms.php">Back</a>