php - 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>';
解决方案
推荐阅读
- postgresql - postgresql 11中的复制槽内存不足错误
- command-line-arguments - 如何将 raku -e 和 -n 与多个文件 glob 一起使用
- tensorflow - 使用 tf-agents 的上下文多武装老虎机的完整示例
- java - 当其内容更改时,使状态修剪栏贡献增加
- python - 如何使 HTML 中的默认文本输入值成为多字 Python 变量?
- amazon-web-services - 如何将 CloudWatch 警报配置为每 X 分钟评估一次
- python - 如果 col 为空字符串,则将相邻列也设为空
- javascript - 如何使用浏览器端 javascript 将具有编码高度值的 32 位 RGB png 转换为 16 位 png?
- sql - 如何连接三个表并将空白字段设置为空?
- javascript - 在javascript中一张一张的随机图像生成器