In my AJAX-page I want to fetch data from a database. In my first page I have del image
to delete a record. I passed the file cid as 'rmvfile' to the next page and fetched and displayed them on the 2nd page.
In my first page I pass cf_id:
<img src="image/delete1.png" alt="delete" style="width:10px;height:10px" title="Remove" onclick="myFunction('.$fet['cf_id'].');">
function myFunction(cid) {
var rmvfile=cid;
if (confirm("Are you sure you want to Delete the file?") == true) {
if(cid!='') {
$.ajax({
type: 'post',
url: 'delete_cli_file.php',
data: {rmvfile: rmvfile},
});
}
}
}
I my 2nd page I use:
<?php
include "config.php";
$s = $_POST['rmvfile'];
$sel = "select cf_id from client_file where cf_id='".$_POST['rmvfile']."'";
$sel1 = mysql_query($sel);
$sfet = mysql_fetch_assoc($sel1);
$file_name = $sfet['file_name']; //not fetched
$echeck = "delete from client_file where cf_id='".$_POST['rmvfile']."'";
$echk = mysql_query($echeck);
$del = "delete from client_file where file_name = '$file_name' ";
$del1 = mysql_query($del);
?>
$echeck = "delete from client_file where cf_id = '".$_POST['rmvfile']."'";
and $sel="select cf_id from client_file where cf_id='".$_POST['rmvfile']."'";
are working.
My problem is that the value is not fetched in $sfet['file_name']
.