动态选择框名称作为表值

时间:2018-09-01 06:01:13

标签: php jquery mysql

mysql

这里选择框名称是表值,当我单击添加更多按钮时,它将克隆整行。效果很好。
但是如何在我的操作页面中保存发布的值
arrco是表计数,其值在jquery中递增

<input type="hidden" name="arrco[0]" value="0">
<?php foreach ($ob->selectdata("select * from tb_attribute") as $key => $attributes) {
    ?>
    <td>
        <select name="<?php echo(strtolower($attributes['attribute_name'])); ?>[0]" class="form-control variation">
            <?php
            $prdvar = $ob->selectdata("select * from tb_variations where attr_id='" . $attributes['attr_id'] . "'");
            foreach ($prdvar as $variations) {
                ?>
                <option value="<?php echo($variations['variations_name']); ?>"><?php echo($variations['variations_name']); ?></option>
                <?php
            }
            ?>
        </select>
    </td>
<?php } ?>

这是我的表结构

<?php
    extract($_POST);
    foreach($arrco as $key => $arrcoval)
    {
        foreach($arrco as $key => $arrcoval)
        {
            foreach($obsec->selectdata("select * from tb_attribute") as $key1 =>  $attributes)
            {
                $verat = ($_POST[strtolower($attributes['attribute_name'])][$key]);
                echo $key.'-'.$verat."<br>";
            }
        }
    }
?>

我输入了3行,但显示了6次

请帮助我

0 个答案:

没有答案