将PHP变量传递给bootstrap模式

时间:2016-08-31 22:00:50

标签: javascript php html

所以我检查了很多关于这个标题的话题,但是找不到合适的答案。

所以基本上我有这张表:

<div class="panel-body">
    <div class="table-responsive">
        <table class="table table-bordered tablesorter">
        <thead>
            <tr>
                <th>Email <i class="fa fa-sort"></i></th>
                <th>Akcje <i class="fa fa-sort"></i></th>
            </tr>
        </thead>
        <tbody>
            <?php 
                $subs = $conn->prepare("SELECT * FROM sub_permission WHERE id_bota=:id");
                $subs->bindParam(":id",$ID);
                $subs->execute();
            ?>
                <form method="post">
                    <?php foreach($subs as $sub){ ?>
                        <tr>    
                            <td>
                                <?php echo $sub['adminEmail']; ?>
                            </td>
                            <td>
                                <input type="hidden" name="id">
                                <button type="button" value="<?php echo $sub["adminEmail"]; ?>" class='btn btn-danger btn-xs' data-toggle="modal" data-target="#modal_DELETE" data-id="<?php echo $sub["adminEmail"]; ?>"> <span class="fa fa-times"> </span> </button><a> </a>
                                <button type="button" class='btn btn-warning btn-xs' data-toggle="modal" data-target="#myModalE"><span class="fa fa-edit"></span></button>
                            </td>
                        </tr>
                    <?php } ?>
                </form>
        </tbody>
        </table>
    </div>
</div>

所以这基本上是用户表,其中包含子管理员,并且有1个动作&#34;删除&#34;。 当有人点击按钮删除时,此模式将显示:

<div class="modal fade" id="modal_DELETE" tabindex="-1" role="dialog" aria-labelledby="modal_nameDELETE">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                <h4 class="modal-title" id="modal_nameDELETE">Sure?</h4>
            </div>
            <div class="modal-body">
                Are you sure you want to remove sub-admin <label><?php echo $sub['adminEmail'];?></label> ?                                                             
                <br>
                </div>
            <form method="post">
                        <div class="modal-footer">
                    <button type="submit" class="btn btn-default" data-dismiss="modal">No</button>
                    <button type="submit" class="btn btn-primary" name="delete">Yes</button>
                        </div>
            </form>
            </div>
    </div>
</div>

问题是表格中有例如3人,我点击了用户3的删除按钮,弹出模式但电子邮件错误。

0 个答案:

没有答案