Php 删除按钮布局

Php 删除按钮布局,php,Php,我已经通过了一个处理复选框的解决方案,并且认为我理解我需要做什么,但是我有一个问题,我把我的删除按钮放在这段代码中。这是我的桌子: <table> <thead> <tr> <th>Camera Name</th> <th>Date Created</th> <th>Video Size</th> <th

我已经通过了一个处理复选框的解决方案,并且认为我理解我需要做什么,但是我有一个问题,我把我的删除按钮放在这段代码中。这是我的桌子:

<table>
    <thead>
    <tr>
        <th>Camera Name</th>
        <th>Date Created</th>
        <th>Video Size</th>
        <th>Video Length</th>
        <th>
            <button type="submit" class="deletebutton" name="delete_video" value="Delete" title="Delete the selected videos" onClick="return confirm('Are you sure you want to delete?')">Delete</button><br>
            <input type="checkbox" name="radioselectall" title="Select All" />
        </th>
    </tr>
    </thead>
    <tbody>

 <?php

for($i=0;$i<$num_videos;$i++)
{
       //do stuff
       //Note: I'm looping here to build the table from the server
?>              
        <tr >
            <td onclick="DoNav('<?php echo $url; ?>');">
                        <?php echo $result_videos[$i]["camera_name"]; ?> 
            </td>
            <td onclick="DoNav('<?php echo $url; ?>');">
                        <?php echo setlocalTime($result_videos[$i]["video_datetime"]); ?> 
            </td>
            <td onclick="DoNav('<?php echo $url; ?>');">
                        <?php echo ByteSize($result_videos[$i]["video_size"]); ?>
            </td>
            <td onclick="DoNav('<?php echo $url; ?>');">
                <?php echo strTime($result_videos[$i]["video_length"]); ?>
            </td>
            <td>
                <form name="myform" action="<?php echo htmlentities($_SERVER['REQUEST_URI']); ?>" method="POST">
                <input type="checkbox" name="radioselect" title="Mark this video for deletion"/>
                <input type="hidden" name="video_name" value="<?php echo $result_videos[$i]["video_name"]; ?>" />
                </form>
            </td>
        </tr>
...

摄像机名称
创建日期
视频大小
视频长度
删除
');">
一种解决方案是将视频的ID放在其“删除”复选框的名称中。然后,您可以通读收到的复选框,并从中解析视频名称。

表单应该围绕整个表,而不是隐藏输入名称,您可以将其放在复选框的名称中:

<input type="checkbox" name="radioselect[<?php echo $result_videos[$i]['video_name']; ?>]" />
这将在所选复选框中循环。您将在
$k
中获得
视频名称
,您可以像处理单个删除一样处理它

foreach(array_keys($_POST['radioselect']) as $k) { ... }