<?php

include '../admin/includes/database.php';
include '../admin/includes/functions.php';
$conn= new Functions();

if(!empty($_POST['phone']) && !empty($_POST['amount'])) {
    $phone = $_POST['phone'];
    $conyear = $_POST['conyear'];
    $amount = $_POST['amount'];
    //sql
    $sql = "UPDATE members SET conyear=:conyear, amount=:amount WHERE phone=:phone";
    $conn->query($sql);
    $conn->bind(":phone", $phone);
    $conn->bind(":conyear", $conyear);
    $conn->bind(":amount", $amount);


    try{
        $conn->execute();
        echo "<script>
$(function () { //ready
          toastr.options.progressBar = true, toastr.options.preventDuplicates = true,
          toastr.success('Member Updated Successfully');
      });
</script>";
    }catch (PDOException $err){
        echo $err->getMessage();
    }
}

    else {
        echo "<script>
    $(function () { //ready
              toastr.options.progressBar = true, toastr.options.preventDuplicates = true,
              toastr.error('All Marked (*) Are Required');
          });
    </script>";
        return false;
    }