<?php
error_reporting(E_ALL);
ini_set('display_errors', TRUE);
ini_set('display_startup_errors', TRUE);
include('config.php');
include('functions.php');
$tables = showTables($connect, $showTables);
if (isset($_POST['table_name'])) {
//echo 'post';
$selectedTable = $_POST['table_name'];
$_SESSION["selectedtable"]=$selectedTable;
} else {
if(isset($_SESSION["selectedtable"])){
//echo 'sess no post';
//var_dump($_SESSION["selectedtable"]); ;
$selectedTable = $_SESSION["selectedtable"];
}else{
//echo 'no sess no post';
$selectedTable = $tables[0][0];
$_SESSION["selectedtable"] = $selectedTable;
$selectedTable = $_SESSION["selectedtable"];
}
}
//var_dump($_SESSION);
?>
<!DOCTYPE>
<html>
<head>
<script type="text/javascript" src="//code.jquery.com/jquery-1.11.0.js"></script>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css"
integrity="sha384-HSMxcRTRxnN+Bdg0JdbxYKrThecOKuH5zCYotlSAcp1+c8xmyTe9GYg1l9a69psu" crossorigin="anonymous">
<!-- Optional theme -->
<!-- <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap-theme.min.css"
integrity="sha384-6pzBo3FDv/PJ8r2KRkGHifhEocL+1X2rVCTTkUfGk7/0pbek5mMa1upzvWbrUbOZ" crossorigin="anonymous">-->
<!--excel-->
<script lang="javascript" src="js/xlsx.full.min.js"></script>
<!--pdf-->
<script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf/1.3.4/jspdf.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jspdf-autotable/3.5.6/jspdf.plugin.autotable.min.js"></script>
<!--data table-->
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/v/dt/dt-1.10.24/datatables.min.css"/>
<script type="text/javascript" src="https://cdn.datatables.net/v/dt/dt-1.10.24/datatables.min.js"></script>
<!--data table ext-->
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/fixedheader/3.1.2/css/fixedHeader.dataTables.min.css">
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.24/css/jquery.dataTables.min.css">
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/buttons/1.7.0/css/buttons.dataTables.min.css">
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js"></script>
<!-- icons -->
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.1.0/css/all.css"
integrity="sha384-lKuwvrZot6UHsBSfcMvOkWwlCMgc0TaWr+30HWe3a4ltaBwTZhyTEggF5tJv8tbt" crossorigin="anonymous">
<!-- fav -->
<link rel="apple-touch-icon" sizes="57x57" href="fav/apple-icon-57x57.png">
<link rel="apple-touch-icon" sizes="60x60" href="fav/apple-icon-60x60.png">
<link rel="apple-touch-icon" sizes="72x72" href="fav/apple-icon-72x72.png">
<link rel="apple-touch-icon" sizes="76x76" href="fav/apple-icon-76x76.png">
<link rel="apple-touch-icon" sizes="114x114" href="fav/apple-icon-114x114.png">
<link rel="apple-touch-icon" sizes="120x120" href="fav/apple-icon-120x120.png">
<link rel="apple-touch-icon" sizes="144x144" href="fav/apple-icon-144x144.png">
<link rel="apple-touch-icon" sizes="152x152" href="fav/apple-icon-152x152.png">
<link rel="apple-touch-icon" sizes="180x180" href="fav/apple-icon-180x180.png">
<link rel="icon" type="image/png" sizes="192x192" href="fav/android-icon-192x192.png">
<link rel="icon" type="image/png" sizes="32x32" href="fav/3232fav.gif">
<link rel="icon" type="image/png" sizes="96x96" href="fav/favicon-96x96.png">
<link rel="icon" type="image/png" sizes="16x16" href="fav/favicon-16x16.png">
<link rel="manifest" href="fav/manifest.json">
<meta name="msapplication-TileColor" content="#ffffff">
<meta name="msapplication-TileImage" content="/ms-icon-144x144.png">
<meta name="theme-color" content="#ffffff">
<script>
function editTable(id){
var tableName = '<?php echo $_SESSION['selectedtable']; ?>';
var idString = id;
var btnaction = 'update';
$.ajax({
url:"data_action.php",
method:"POST",
data:{tableName:tableName, dataId:idString, action:btnaction},
// dataType:"json",
beforeSend: function() {
$('.modal-title').html("<i class='glyphicon glyphicon-pencil'></i> Edit Data For "+ tableName);
$('#actionModal').modal('show');
},
success:function(data)
{
$('#actionDiv').html(data);
},
error: function (xhr, ajaxOptions, thrownError) {
// alert("ERROR:" + xhr.responseText+" - "+thrownError);
$('#alertDiv').html("ERROR:" + xhr.responseText+" - "+thrownError);
},
complete: function() {
$("#"+idString).css("color", "red");
}
})
}
</script>
<style>
/* enable absolute positioning */
.inner-addon {
position: relative;
}
/* style icon */
.inner-addon .glyphicon {
position: absolute;
padding: 10px;
pointer-events: none;
}
/* align icon */
.left-addon .glyphicon { left: 0px;}
.right-addon .glyphicon { right: 0px;}
/* add padding */
.left-addon input { padding-left: 30px; }
.right-addon input { padding-right: 30px; }
</style>
</head>
<body>
<div class="container-fluid">
<div class="row">
<div class="col-md-12 ">
<hr/>
|