jQuery code:
$(document).ready(function(){
$('.tablePend tbody').on('click','.btn',function(){
// var id=$('#test-pend').val();
var currow=$(this).closest("tr");
var colId = currow.find('td:eq(3)').text();
var id = colId;
alert(id);
$.post("../admin/detail.php", {
pid:id
});
});
});
So the code above works perfectly, the alert shows the result that I want
<?php
include('dbh.inc.php');
include_once('header.php');
if(isset($_POST['pid'])) {
$id = mysqli_real_escape_string($conn, $_POST['pid']);
$sql= "SELECT event_name, event_desc, event_date, event_id FROM events WHERE event_id='$id'";
$result= mysqli_query($conn, $sql);
echo $id;
} else {
echo 'nothing';
}
include_once 'footer.php';
?>
So right here, the PHP automatically goes to the else statement which shows nothing, I don't know what went wrong, I've tried all possible ways, for days, this is really making me frustrated, and I also believe that I made a simple mistake but I can't find it.