<?php
require('config.php');

if($_POST['test'] == ''){
header("location:".Config::BASE_URL.'/index.php/backend'); 
exit();
}else{
    ?>
<!DOCTYPE html>
<html> 
<head>
    <title>Reminders Configuration Page</title>
    
    <script>
        function showUser(str) {
            if (str=="") {
            document.getElementById("txtHint").innerHTML="";
            return;
            }   
    var xmlhttp=new XMLHttpRequest();
    xmlhttp.onreadystatechange=function() {
    if (this.readyState==4 && this.status==200) {
      document.getElementById("txtHint").innerHTML=this.responseText;
    }
  }
  
  xmlhttp.open("GET","serviceconfigone.php?q="+str,true);
  xmlhttp.send();
  }       
    
    </script>
    <style> 
    body {
          padding-left: 20px;
          padding-bottom: 10px;

    }
    </style>
    
<?php
echo '<link rel='.'"'.'stylesheet'.'"'. 'type='.'"'.'text/css'.'"'. 'href='.'"'.'assets/ext/bootstrap/css/bootstrap.min.css?52FX8'.'"'.'>'; 
echo '<link rel='.'"'.'stylesheet'.'"'. 'type='.'"'.'text/css'.'"'. 'href='.'"'.'assets/ext/jquery-ui/jquery-ui.min.css?52FX8'.'"'.'>'; 
echo '<link rel='.'"'.'stylesheet'.'"'.'type='.'"'.'text/css'.'"'. 'href='.'"'.'assets/ext/jquery-qtip/jquery.qtip.min.css?52FX8'.'"'.'>'; 
echo '<link rel='.'"'.'stylesheet'.'"'. 'type='.'"'.'text/css'.'"'. 'href='.'"'.'assets/ext/trumbowyg/ui/trumbowyg.min.css?52FX8'.'"'.'>'; 
echo '<link rel='.'"'.'stylesheet'.'"'. 'type='.'"'.'text/css'.'"'. 'href='.'"'.'assets/css/backend.css?52FX8'.'"'.'>'; 
echo '<link rel='.'"'.'stylesheet'.'"'. 'type='.'"'.'text/css'.'"'. 'href='.'"'.'assets/css/general.css?52FX8'.'"'.'>'; 
echo '<link rel='.'"'.'stylesheet'.'"'. 'type='.'"'.'text/css'.'"'. 'href='.'"'.'assets/js/popup.js?52FX8'.'"'.'>'; 
echo '<link rel='.'"'.'stylesheet'.'"'. 'type='.'"'.'text/css'.'"'. 'href='.'"'.'assets/css/frontend_general.php'.'"'.'>'; 

?>

</head>

<body style="background-color:#ffffff">
<?php
echo '<a href='.'"'.Config::BASE_URL.'/index.php/backend/settings'.'"'.'>'.'<image src='.'"'.Config::BASE_URL.'/leftarrow.png'.'"'. 'width='.'"'.'100'.'"'. 'height='.'"'.'50'.'"'.'>'.'</a>'.'<br>';

?>
<h2>Reminders Configuration Page</h2>
<form id="" method="POST" action="reminder_process.php"> 


<select id="service" name="service" onchange="showUser(this.value)">
<?php
$linkID = new PDO('mysql:host='.Config::DB_HOST.';dbname='.Config::DB_NAME, Config::DB_USERNAME, Config::DB_PASSWORD);
$linkID->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); // Setting ERRMODE

$result = $linkID->query("SELECT id, name FROM ea_services")->fetchAll(PDO::FETCH_ASSOC);

echo '<option value='.'"'.'"'.'>'.'PICK'.'</option>';
foreach($result as $r){
echo '<option value='.'"'.$r['id'].'"'.'>'.$r['name'].'</option>';  
}
echo '</select>';
?>


<br>

<div id="txtHint"></div>


</form>    
</body>
</html>
<?php

}
?>