Hello guys...actually it's going to be a pretty hard question and probably hard to solve. Here it goes:
I have a table of added members and the same table exists in "remove_members" page where I added a checkbox to each user's picture. The pic/user is supposed to be deleted when the checkbox is ticked. The problem is this - the checkboxes need to be and are processed within PHP and are all concatenated to the pictures. That's why I cannot use them as an array and they won't return anything apart from one value if the array is used. It's because all of them will have the same name after concatenation. The title of the checkboxes returns correct value corresponding to each picture. Any ideas how you can get a value from each individual checkbox ? Regards for any comments. Here's the code:
<?php
//members add
$sql_members = mysql_query("SELECT * FROM `auth` WHERE `userName`='".$_SESSION['logged']."'");
while ( $row = mysql_fetch_array($sql_members)) {
$userName = $row['userName'];
$uid = $row['uid'];
}
$sql_members_name = mysql_query("SELECT a.userName, a.uid, m.uid, m.friend_id , m.user_id FROM `auth` a LEFT OUTER JOIN `members` m ON a.uid = m.friend_id ");
$sql_members_add = mysql_query("SELECT * FROM `members`,`auth` WHERE auth.uid=members.friend_id AND members.user_id = '$uid' ORDER BY `user_id` DESC");
while ($rows = mysql_fetch_array($sql_members_add)) {
$friends = $rows['friend_id'];
$user = $rows['userName'];
$user_id = $rows['friend_id'];
//name length
$user = substr($user, 0, 12);
//$strFirstname = strlen($user);
//if ($strFirstname>5) { $user.=".."; }
/////////////
$f_ex = "members/".$friends."/userImg1.jpg";
if (file_exists($f_ex)) {
$mem_dir_add_pic .= "<form method='post' name='myform' id='myform' action='remove_members.php'><a href='see_member.php?id=$user_id'><img src='members/".$friends."/userImg1.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><span style='float:left;margin-top:2px;margin-left:-5px'><input type='checkbox' name='del_mem2' value='".$user_id."' /></span></form>";
} else {
$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_pic2 ;
}
$mem_dir_add_pic .= "<html><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' title='$user_id' value='$user_id'/></span></form></html>";
}
$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' ");
}
?>