douzuizhuo0587 2015-10-23 12:06 采纳率: 0%
浏览 32

将php变量从paginator传递给modal

i have paginator that display top "n" tasks with bottuns to change or delete a task:

<?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 } ?>

and on the button click it opens the modal that have text change and update 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>

so i need to get php variable $task['Task']['id'] from the paginator (inside foreach loop) and send it to modal and echo it in place of "xx" in form action.

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 微信会员卡接入微信支付商户号收款
    • ¥15 如何获取烟草零售终端数据
    • ¥15 数学建模招标中位数问题
    • ¥15 phython路径名过长报错 不知道什么问题
    • ¥15 深度学习中模型转换该怎么实现
    • ¥15 HLs设计手写数字识别程序编译通不过
    • ¥15 Stata外部命令安装问题求帮助!
    • ¥15 从键盘随机输入A-H中的一串字符串,用七段数码管方法进行绘制。提交代码及运行截图。
    • ¥15 TYPCE母转母,插入认方向
    • ¥15 如何用python向钉钉机器人发送可以放大的图片?