EDITED with UPDATED CODE: Im missing something here; the jQuery is working, but the variables arent passing to the query. Below is all of the updated code:
<span class="accepted"><a href="#" class="accept" id="<?php echo $id1; ?>" data-order="<?php echo $name; ?>"><input type="button" title="accept" value="Accept" /></a></span>
AJAX Script
<script type="text/javascript">
$(function() {
$(".accept").click(function(){
var element = $(this);
var del_id = element.attr("id");
var order_id = element.attr("data-order");
//if(confirm("Are you sure you want to delete this?"))
//{
$.ajax({
type: "POST",
url: "accept.php",
//data: info,
data: {id:del_id,order_id:order_id},
success: function(){}
//
});
$(this).parents(".show").animate({ backgroundColor: "#003" }, "slow")
.animate({ opacity: "hide" }, "slow");
//}
//return false;
});
});
</script>
new php file
include('db.php');
$id = $_POST['id'] ;
$name = $_POST['order_id'] ;
$sql = "UPDATE mgap_orders SET mgap_status = 1 WHERE mgap_ska_id = :id AND mgap_ska_report_category = :name";
$stmt = $pdo->prepare($sql);
$stmt->execute(array(
':id' => '$id',
':name' => '$name'
));