首页 > 解决方案 > php好友请求系统未从提交按钮发送正确数据

问题描述

我正在使用 php 和 sql。我为好友请求通知创建了一个表格。这些名称是从请求表中提取的。通知使用 while 循环显示在 网页上。每个请求都显示提出请求的人的姓名,并具有用户将建立的友谊级别。每个通知都有自己的提交按钮。当我单击任何提交按钮时,它会从页面上的最后一个通知中获取信息。当按下给定的提交按钮时,我如何才能获得正确的信息来发布。

echo '<div class="container-fluid">';
echo '<div class="container-sm posts shadow p-3 mb-5 bg-white rounded">';
echo '<div class="container title"><h3>'; echo $current_user; echo '</h3></div>';
echo '<div class="container content">';


if ($result = $conn->query($query)) {
  while ($row = $result->fetch_assoc()) {
    if( $current_user == $row["currentUser"]){
      if($row["current_request"] == 1){
        $_SESSION["fid"] = $row["friend_request_name"];
          echo '<form action = "include/approve_friend_request.php" method = "POST">';
            echo $row["friend_request_name"];echo '<select class="form-select" aria-label="Default select example" id="d" name="friend_reqest_level">';
            
            echo '<option value="1">friends</option>';
            echo '<option value="2">best friends</option>';
            echo ' </select>';
            echo '<button type="submit" name = "submit" class="btn btn-dark">Submt</button> ';
            echo '<br>';
          }
    }         
  }
}

echo '<br>';
echo '<br>';
echo '</div>';
echo '<div class="container footer"><p class="footer">.</p></div>';
echo '</div>';
echo '</div>';

标签: phpmysql

解决方案


推荐阅读