Php 从链接选项卡获取选中的复选框

Php 从链接选项卡获取选中的复选框,php,mysql,Php,Mysql,我有三张桌子 Products +---+--------------+ |ID | NAME | +---+--------------+ | 1 |Kookboek | | 2 |Lotion | | 3 |Rijles theorie| +---+--------------+ Cats +---+----------+ |ID | CAT | +---+----------+ | 1 |Speelgoed | | 2 |Body

我有三张桌子

Products

+---+--------------+
|ID | NAME         |
+---+--------------+
| 1 |Kookboek      |
| 2 |Lotion        |
| 3 |Rijles theorie|
+---+--------------+

Cats
+---+----------+
|ID | CAT      |
+---+----------+
| 1 |Speelgoed |
| 2 |Body      |
| 3 |Boeken    |
| 4 |Verzorging|
+---+----------+

link
+---+---+
|PID|CID|
+---+---+
| 1 | 3 |
| 2 | 2 |
| 3 | 1 |
| 2 | 4 |
+---+---+
我如何做到这一点:

如果我从乳液中提取数据 复选框是从bodyverzorging中选中的

我知道内部连接,但如何构建正确的查询

<?php
        $sql = "
            SELECT 
                link.pid,
                GROUP_CONCAT(cats.catname ORDER BY cats.catname SEPARATOR ', ') categories 
            FROM 
                link
            JOIN products ON link.pid = products.id 
            JOIN cats ON link.cid = cats.id
            GROUP BY link.pid
        ";
?>

请向我们展示您期望的结果。SQL不支持复选框。您好,GMB,我在问题中添加了一些详细信息:)
<label><input type="checkbox" value="1">Speelgoed</label>
<label><input type="checkbox" value="2" checked="checked">Body</label>  
<label><input type="checkbox" value="3">Boeken</label>  
<label><input type="checkbox" value="4" checked="checked">Verzorging</label>