click and submit button id with jquery
- by user836910
my aim is to submit a button id using jquery into a database im only interested in the button not its value.
$("#button").click(function(){
var p = $(this).attr("id");
$.ajax({
type: "POST",
url: subpage.php",
data: 'b='+p,
cache: false,
success: function(html)
{
//process live
}
});
return false;
});
subpage.php
$item = $_POST['b'];
$query = mysql_query("SELECT * FROM table WHERE id = '25' AND bttnid = '$item'");
if(count($query)==0){
mysql_query("INSERT INTO table VALUES ('','25','$item') ");
}
it doesn't submit. please assit