DaSe
12-04-2010, 12:46 AM
Hello guys...If I can ask you for some support that would be great..
The problem is this: I have a table of users to be deleted. I placed a checkbox next to each user in a table. The checkboxes are added witihin PHP script and the name of the checkbox is an array. But the $_POST returns only last value regardless and the rest of the users' pics return 0. When you place a title into the checkbox the title returns correct user_id. For now I have no clue why I can delete only the latest pic.
Here's the code:
in a while loop:
$mem_dir_add_pic .= "<a href='see_member.php?id=$user_id'><img src='members/avatar/avatar.jpg' width='41' height='60' border='1' align='left' hspace='3' vspace='5' style='border-color:black' alt='' title='' style='float:left'/><span class='style2' style='float:left;margin-top:55px;margin-left:-46px'> ".$user." </span></a>";
$mem_dir_add_pic .= "<form method='post' name='myform' id='myform' action='remove_members.php'><span style='float:left;margin-top:2px;margin-left:-5px'><input type='checkbox' name='del_mem[]' value='".$user_id."'/></span></form>";
}
$mem_check = $_POST['del_mem'];
if ($mem_check == $user_id) {
$proceed = mysql_query("DELETE FROM `members` WHERE friend_id='$mem_check' AND user_id='$uid' ");
}
Regards and thanks for any comments..
The problem is this: I have a table of users to be deleted. I placed a checkbox next to each user in a table. The checkboxes are added witihin PHP script and the name of the checkbox is an array. But the $_POST returns only last value regardless and the rest of the users' pics return 0. When you place a title into the checkbox the title returns correct user_id. For now I have no clue why I can delete only the latest pic.
Here's the code:
in a while loop:
$mem_dir_add_pic .= "<a href='see_member.php?id=$user_id'><img src='members/avatar/avatar.jpg' width='41' height='60' border='1' align='left' hspace='3' vspace='5' style='border-color:black' alt='' title='' style='float:left'/><span class='style2' style='float:left;margin-top:55px;margin-left:-46px'> ".$user." </span></a>";
$mem_dir_add_pic .= "<form method='post' name='myform' id='myform' action='remove_members.php'><span style='float:left;margin-top:2px;margin-left:-5px'><input type='checkbox' name='del_mem[]' value='".$user_id."'/></span></form>";
}
$mem_check = $_POST['del_mem'];
if ($mem_check == $user_id) {
$proceed = mysql_query("DELETE FROM `members` WHERE friend_id='$mem_check' AND user_id='$uid' ");
}
Regards and thanks for any comments..