<?php session_start() ;
include 'databaseConnection.php' ;
$sqlCommand3 = "SELECT * FROM posts ;" ;
$result3 = mysqli_query($conn , $sqlCommand3);
$resultCheck = mysqli_num_rows($result3);
while ($row = mysqli_fetch_array($result3)) { ?>
<tr>
<td style="padding-left: 10px;">
<?php echo $row['poster']; ?>
</td>
<td style="padding-left: 45px;">
<?php echo $row['post_destination']; ?>
</td>
<td style="padding-left: 30px;">
<?php echo $row['post_readyTime']; ?>
</td>
<td style="padding-left: 45px;">
<?php echo $row['post_numberOfPassenger'];?>
</td>
<td style="padding-left: 32px;">
<?php echo $row['post_submitTime']; ?>
</td>
<td>
<form action="riderJoin.php" method="post">
<input type ="hidden" name ="id" value="<?php echo $row['post_id']; ?>" >
<input type =submit class="edit_btn" name = submit value = "Join">
</form>
</td>
<!--<td>
<a href="riderPage.php?del=<?php /*echo $row['post_id'];*/ ?>" class="del_btn" id="<?php /*echo $row['post_id'];*/ ?>">Delete</a>
</td>-->
</tr>
<?php } ?>
</table>
</div>
</div>
<script type="text/javascript">
$("td:nth-child(4):contains('5')").addClass('redWord');
var x = document.getElementsByClassName('edit_btn');
<?php if (isset($_POST['submit'])) { ?>
var i = <?php echo $_SESSION['postId'] ; ?> - 1 ;
$(x[i]).val('Delete').css('background-color','red').css('color','white');
<?php }?>
</script>
每当设置$ _POST ['submit']时,如何使用新动作(在“join”按钮之前)添加新输入(type =“submit”value =“delete”)?我不想在每个“加入”按钮之前添加新输入。相反,我只想在单击特定的“加入”按钮时单击特定的“加入”按钮后添加。此外,如果我在其他单元格中单击另一个“加入”按钮,也会发生类似的效果。所以最后,在点击两个“加入”按钮后,在特定点击的“加入”按钮之前,每个应该只添加两个删除按钮。怎么解决?
非常感谢:)