Delete Values from a database using jquery
I have remove which is given as a link. If I click remove I want to remove a value from the database, but certainly its not working... what's wrong?
<td align="center">
<div id="remove">
<a href='#' onclick="removeDesign()">remove</a>
</div>
</td>
function removeDesign()
{
var confirmation = co开发者_开发技巧nfirm("Are You Sure You Want to Delete This Item?")
if(confirmation == true)
{
$.post('remove.php',{designId : [<?=$_SESSION['designid']?>]});
}
}
remove.php:
<?php
include("config/dbconn.php");
$DesignId=$_POST['designId'];
$sql = "delete from design where id = '".$DesignId."'";
mysql_query($sql);
?>
The problem is the designid value is not passing to the remove.php? Can any one show the solution?
Try
$.post("remove.php",{designId : "'" + <?php echo $_SESSION['designid']?> + "'"} );
精彩评论