I'm using this example's code https://datatables.net/examples/server_side/simple.html
I want to use $_GET variable in the server_processing.php file so that I can specify the value and doing this from the url. For example table.php?table-id=table1
index.html
<a href="table.php?table-id=table1">Table 1</a>
<a href="table.php?table-id=table2">Table 2</a>
<a href="table.php?table-id=table3">Table 3</a>
table.php
<?php
// Get
$var = $_GET['table-id'];
?>
<table id="example" style="width:100%">
<thead>
<tr>
<th>Payslip ID</th>
<th>Employee ID</th>
<th>Employee Name</th>
</tr>
</thead>
</table>
<script>
$(document).ready(function() {
$('#example').DataTable( {
"processing": true,
"serverSide": true,
"ajax": "scripts/server_processing.php"
} );
} );
</script>
scripts/server_processing.php
<?php
// DB table to use
$table = '$var';
// Table's primary key
$primaryKey = 'id';
// indexes
$columns = array(
array( 'db' => 'first_name', 'dt' => 0 ),
array( 'db' => 'last_name', 'dt' => 1 ),
array( 'db' => 'position', 'dt' => 2 )
);
// SQL server connection information
$sql_details = array(
'user' => 'root',
'pass' => '',
'db' => 'sampledb',
'host' => 'localhost'
);
require( 'ssp.class.php' );
echo json_encode(
SSP::simple( $_GET, $sql_details, $table, $primaryKey, $columns )
);
variable table-id is undefined. Is there a way to do this? The link part is important so I cannot remove that from the code.