<?php

ini_set('display_errors',1);
ini_set('display_startup_errors',1);
error_reporting(E_ALL);

if ($_SERVER["REQUEST_METHOD"] == "POST") {
  // collect value of input field
  $data = $_POST['onCall'];
  if ($data == NULL) {
    echo "data was posted incorrectly\n";
	var_dump($_POST);
  } else {
	  //write to csv file
	  $myFile = fopen("FinalData.csv", "a") or die("Unable to open file");
	  $realTime = time();
	  fwrite($myFile, $data.",".$realTime."\n");
	  fclose($myFile);
  }
}
?>