<?php
session_start();
header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Methods: GET, POST');
header("Access-Control-Allow-Headers: X-Requested-With");
header('Content-Type: application/json; charset=utf-8');

include 'config.php';



function check_input($par) {
  $par = trim($par);
  $par = stripslashes($par);
  $par = htmlspecialchars($par);
  return $par;
}



$region=check_input($_POST['region']);

$region = mysqli_escape_string($con, $region);



$sql="SELECT * FROM helpline";
$result=$con->query($sql) or die ("error: Server error ".mysqli_error($con));


if($result)
{

$rows=mysqli_fetch_assoc($result);
$helpline = $rows['helpline'];   

$suc = "Success";

}

$con->close();

header('Content-Type: application/json; charset=utf-8');
$output = array('success'=>$suc, 'helpline'=> $helpline);
echo json_encode($output); //output JSON data
//mysql_close($con);
?>

