如何获取选中的chekbox值以在PHP中的mysql查询中使用

如何获取选中的chekbox值以在PHP中的mysql查询中使用,php,mysql,Php,Mysql,我可以将MySQL查询列为表。但是我不能选择一个行值来使用另一个MySQL查询 以下是代码: <?php if(isset($_POST['btn_user'])) { $username = $_POST['user']; $sql_devicename = "SELECT users.id, users.USER,

我可以将MySQL查询列为表。但是我不能选择一个行值来使用另一个MySQL查询 以下是代码:

<?php
if(isset($_POST['btn_user'])) {
    $username = $_POST['user'];
    $sql_devicename = "SELECT       users.id,
                                            users.USER,
                                            accounts.deviceid,
                                            devices.name
                            FROM            users
                            INNER JOIN  accounts
                            ON          users.id = accounts.userid
                            INNER JOIN  devices
                            ON          accounts.deviceid = devices.id
                            WHERE       users.USER LIKE '%$username%'";

    if($result_devicename = $mysqli->query($sql_devicename)){
        if($result_devicename->num_rows > 0){
?>

                                            <table>
                                                <thead>
                                                    <tr>
                                                        <th data-field="id">Cihaz Adı</th>
                                                        <th data-field="id">Seçim</th>
                                                    </tr>
                                                </thead>
                                                <tbody>
                                                        <?php while($row = $result_devicename->fetch_array()){ ?>
                                                        <tr>
                                                            <td>
                                                            <?php echo $row['name']  ?>
                                                            </td>
                                                            <td>
                                                                <input type="checkbox" name="device_secret" id="<?php echo $row['deviceid']?>"/>
                                                                <label for="<?php echo $row['deviceid']?>"></label>
                                                            </td>
                                                        </tr>
<?php 
}
$result_devicename->free();
} else{
    echo "No records matching your query were found.";
}
} else{
    echo "ERROR: Could not able to execute $sql_devicename. " . $mysqli->error;
}}?>
</tbody>
                                            </table>
                                        </div>
                                            <div class="col s11"><blockquote>Init secret giriniz:</blockquote></div>
                                            <div class="input-field col s11">
                                                <i class="material-icons prefix">&#xE0DA;</i>
                                                <input id="Secret" type="text" class="validate" name="secret" pattern="^([a-fA-F0-9]{16}|[a-fA-F0-9]{32})$" title="HEX değer, 16 yada 32 karakter">
                                                <label for="Secret">Init Secret</label>
                                            </div>

                                            <div class="input-field col s11">
                                                <button class=" btn-flat waves-effect waves-light right" type="submit" name="btn_secret">Güncelle
                                                    <i class="material-icons right">send</i>
                                                </button>
                                            </div>
                                        </form>

<?php
if (isset($_POST['btn_secret'])){ ?>
 echo $_POST['secret']; 
 }
?>      

在新的MySQL查询中使用。但是无法获取所选行的值。有什么问题吗?

如果我像这样更改php:

<?php
if (isset($_POST['btn_secret'])){ ?>
 echo $_POST['device_secret']; 
 }
?>

echo$_POST['device_secret'];
}
?>
我可以得到价值。
Thanx

添加值属性,如

<?php
if (isset($_POST['btn_secret'])){ ?>
 echo $_POST['device_secret']; 
 }
?>