I want to take actions using button. That is if I press edit or delete button user navigate to action.php
page. Where my delete or edit query is written. I have navigated using POST method to action.php
action.p开发者_JS百科hp
$remove = $_REQUEST['remove'];
if(isset($_POST["remove"])) {
$sql = "DELETE FROM t_s_list WHERE `s_id` ='$remove'";
mysql_query($sql);
$NEW="This records is Deleted";
//header("location: manage_song.php?msg=$NEW");
}
Bit confused that what value is to be passed to compare it with field s_id
probably be an integer value corresponding to the primary key of the table, i am assuming..
print the $_REQUEST['remove']; and see the out put you can see the passing value
if (isset($_POST["remove"]))
{
$remove = mysql_real_escape_string($_POST["remove"],$link);
$sql = "DELETE FROM t_s_list WHERE s_id ='$remove'";
mysql_query($sql,$link);
$NEW="This records is Deleted";
//header("location: manage_song.php?msg=$NEW");
}
else if (isset($_POST["edit"]))
{
}
else
echo 'Invalid Request !';
精彩评论