将php变量从paginator传递给modal

时间:2015-10-23 12:06:41

标签: javascript php html cakephp bootstrap-modal

我的分页器显示顶部" n"使用bottuns更改或删除任务的任务:

<?php
    foreach($tasks as $task) {
?>
    <li>
        <div class="task-title">
            <span class="task-title-sp"><?php echo $task['Task']['task']; ?></span>
            <span class="badge badge-active"><?php echo $task['Task']['nicedate'] ?></span>
            <div class="pull-right hidden-phone">
                <button class="btn add-btn btn-xs" data-toggle="modal" data-target="#write">
                    <i class="fa fa-pencil"></i>
                </button>
                <button class="btn dismiss-btn btn-xs">
                   <i class="fa fa-trash-o "></i>
                </button>
            </div>
        </div>
    </li>
<?php } ?>

然后在按钮上单击它会打开包含文本更改的模式并更新bottun:

        <div class="modal" id="write" tabindex="-1" role="dialog" aria-labellbyid="writeLabel">
            <div class="modal-dialog" role="document">
                <form id="update-form" action="/tasks/edit?id=xx" method="post">
                    <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" aria-labellbyid="writeLabel">Unesi promjene</h4>
                        </div>
                        <div class="modal-body">
                            <textarea class="form-control" rows="5"></textarea>
                        </div>
                        <div class="modal-footer" id="edit-footer">
                            <input type="submit" class="btn see-btn" value="Ažuriraj">
                        </div>
                    </div>
                </form>
            </div>
        </div>

所以我需要从paginator(在foreach循环内)获取php变量$task['Task']['id']并将其发送到modal并用它来代替&#34; xx&#34;在形式行动。

0 个答案:

没有答案