Dan13071992
11-13-2011, 12:03 PM
hello, im having problems with my radio butons, i have two parts to this script, the first part is adding friends, the second is removing them from a list that is run using radio buttons.
the first part (adding friends) works fine, all i have to do by myself now is make it so you cannot add the same person again and again, however the part i am having trouble with is deleting the friend. both the php coding and the friends on the list that you can select to remove will be posted below.
Removing friends php script:
if(strip_tags($_POST['removesubmit']) && strip_tags($_POST['removesubmit'])){
$removePer=strip_tags($_POST['removesubmit']) && strip_tags($_POST['removesubmit']);
mysql_query("DELETE FROM `friends` WHERE `username`='$fetch->username' AND `person`='$removePer' AND `type`='Friend' LIMIT 1");
$message= "<strong>You removed $removePer from your friends list!</strong><br>";
}
Friends list to select who to remove:
<tr>
<td>Your Friends:</td><td>
<?php
$friend=mysql_query("SELECT * FROM friends WHERE username='$fetch->username' AND type='Friend' ORDER BY id");
$num_rows =mysql_num_rows($friend);
if ($num_rows == "0"){
echo "You have no friends on your friends list!";
}else{
while($friend1=mysql_fetch_object($friend)){
echo "<input type='radio' name='removesubmit' value='$friend1->person'><a href='profile.php?viewuser=$friend1->person'>$friend1->person</a><br>";
} }
?>
</td>
</tr>
<tr>
<td> </td>
<td align=right><input type="submit" name="removesubmit" id="removesubmit" value="Remove"></td>
</tr>
All that comes up when I try to remove a user is "You removed 1 from your friends list!" i dont know how its get the answer of "1".
any help would be appreciated. cheers guys.
Dan13071992
the first part (adding friends) works fine, all i have to do by myself now is make it so you cannot add the same person again and again, however the part i am having trouble with is deleting the friend. both the php coding and the friends on the list that you can select to remove will be posted below.
Removing friends php script:
if(strip_tags($_POST['removesubmit']) && strip_tags($_POST['removesubmit'])){
$removePer=strip_tags($_POST['removesubmit']) && strip_tags($_POST['removesubmit']);
mysql_query("DELETE FROM `friends` WHERE `username`='$fetch->username' AND `person`='$removePer' AND `type`='Friend' LIMIT 1");
$message= "<strong>You removed $removePer from your friends list!</strong><br>";
}
Friends list to select who to remove:
<tr>
<td>Your Friends:</td><td>
<?php
$friend=mysql_query("SELECT * FROM friends WHERE username='$fetch->username' AND type='Friend' ORDER BY id");
$num_rows =mysql_num_rows($friend);
if ($num_rows == "0"){
echo "You have no friends on your friends list!";
}else{
while($friend1=mysql_fetch_object($friend)){
echo "<input type='radio' name='removesubmit' value='$friend1->person'><a href='profile.php?viewuser=$friend1->person'>$friend1->person</a><br>";
} }
?>
</td>
</tr>
<tr>
<td> </td>
<td align=right><input type="submit" name="removesubmit" id="removesubmit" value="Remove"></td>
</tr>
All that comes up when I try to remove a user is "You removed 1 from your friends list!" i dont know how its get the answer of "1".
any help would be appreciated. cheers guys.
Dan13071992