Hello,

I tried to created a social networking system in which I created a part of adding friends so the problem I am having if the firend is not in his are like he searched a friend normally so that friend is not in his system so it show as add friend button but in actual it's not happening

 <?php
 $result = mysqli_query($connection,"SELECT * FROM friends WHERE (user_1='$uid' OR  user_2='$uid') AND (user_1='$user' OR user_2='$user')");
 while($row = mysqli_fetch_array($result)) {
 $status = $row['status'];
 if($status == '0') {
 ?>
 <input type="button" class="btn btn-default friend" value="+ Friend Request Sent" disabled />
 <?php } elseif ($status == '1') { ?>
 <button type="button" class="btn btn-default friend" disabled><i class="fa fa-check"></i> Friends</button>
 <?php } else { ?>
 <form method="POST" action="viewp.php">
 <input type="hidden" value="<?php echo $uid; ?>" name="friend" />
 <input type="submit" class="btn btn-default friend" name="addfriend" value="+ Add Friend" />
 </form>
 <?php } }?>

Add a friend button is not working though what might be the problem if any thing is not clear please let me know so I will clearify more

Add a friend button is not working

What exactly is not working?

Next time please write your question with some punctuation. It's very hard to read.

commented: common issue, heh heh +15
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.