i have code, but isn't run in barang.php i have this code :
barang.php
<?php
$p=isset($_GET['act'])?$_GET['act']:null;
switch($p) {
default :
echo '':
break;
case "edit":
include "editrefbrg.php";
break;
}
and in pagination.php i have this code :
paginatio.php
<td>
<a href="?page=barang&act=edit" target="blank" class="edit" id='.$row["id"].'>
<i class="glyphicon glyphicon-edit"></i>
</a>
</td>
for ajax i use this code :
$(document).on("click",".edit",function(){
var id = $(this).attr('id');
console.log(id);
if(confirm("edit Data ?")){
$.ajax({
type : "POST",
data: "id="+id,
url : "editrefbrg.php?id="+id,
dataType: "json",
success: function(result){
$(this).attr('id');
}
})
}else{
return false;
}
});
in file editbrg.php i'm use this code :
include "config/koneksi.php";
$result ="";
$id = $_GET['id'];
$hasil = mysql_query("SELECT concat(f,'.',g,'.',h,'.',i,'.',j) as id,nm_barang as nama,masa_manfaat as umur FROM ref_barang WHERE f = SUBSTRING('".$id."',1,2) AND g = SUBSTRING('".$id."',4,2) AND h = SUBSTRING('".$id."',7,2)
AND i = SUBSTRING('".$id."',10,2) AND j = SUBSTRING('".$id."',13,3) ");
$d = mysql_fetch_array($hasil);
echo'$d["id"] ';
but in href error code like :
Notice: Undefined index: id in D:\xampp\htdocs\skripsiphp\editrefbrg.php on line 5