<!DOCTYPE html>
<?php 
if (isset($_GET['id'])) {
    $id = $_GET['id'];
    include 'class/smstext.class.php';
    $smstext = new smstext();
    $total = $smstext->countSentSMS();
    $data = $smstext->getSingle($id);
}
?>
<html>
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>SMSAPP | Read Sms</title>
    <?php 
include "includes/_metaheader.php";
?>
    <?php 
include "includes/_csslinks.php";
?>
    <!-- fullCalendar 2.2.5-->
  <body class="hold-transition skin-blue sidebar-mini">
    <div class="wrapper">

      <!-- header -->
      <?php 
include "includes/_header.php";
?>

      <!-- Left side column. contains the logo and sidebar -->
 *
 * get the variables
 * update the table
 * use update()
 * stay on page and display u[dated data
 **/
if (isset($_POST['draft-sms'])) {
    // get the field data
    $recipients = trim($_POST['recipient-phone']);
    $message = trim($_POST['smstext']);
    //update the data
    $is_draft = 1;
    $updated = $smstext->update($draft_id, $recipients, $message, $is_draft);
}
// get the data from table
$draft_sms = $smstext->getSingle($draft_id);
?>
<html>
  <head>
    <meta charset="utf-8">
    <title>SMSAPP | Edit Draft</title>
    <?php 
include "includes/_metaheader.php";
?>
    <?php 
include "includes/_csslinks.php";
?>
    <!-- fullCalendar 2.2.5-->
    <link rel="stylesheet" href="plugins/fullcalendar/fullcalendar.min.css">
    <link rel="stylesheet" href="plugins/fullcalendar/fullcalendar.print.css" media="print">
    <!-- iCheck -->