如何将php值发送给模态

时间:2014-02-15 15:46:10

标签: php modal-dialog

我有一个返回一行值的查询

    <?php
    $chapter_title = $story_data['chapter_title'];

我有一个href链接,显示点击时的模态

    echo "<a href='#deleteModal'  name='$chapter_title' >delete chapter</a>";   

显示

    echo "<div id='deleteModal' class='modalDialog'>
                <div>
                    <h3>Delete Chapter Confirmation </h3><h3 style = 'color:red'> $chapter_title</h3><hr>
                    <div style='display:inline-block;width:auto%'>
                        <text>You are about to delete this chapter. <br />It cannot be restored at a later time! <br />Do you still want to continue?</text>
                        <br><br>
                        <div id='create_btn'><a href=''>Delete</a></div>
                        <div id='cancel_btn'><a href=''>Cancel</a></div>
                        <br><br>
                    </div>
                </div>
    </div>";
    ?>

但我在显示正确的$ chapter_title时遇到问题。即使我单击第二行的删除按钮,它仍然显示第一行的标题。请帮我做点什么。

2 个答案:

答案 0 :(得分:0)

而不是

<h3 style = 'color:red'> $chapter_title</h3>

尝试回显内容

<h3 style = 'color:red'><?php echo $chapter_title; ?></h3>

答案 1 :(得分:0)

校正

<a href='#deleteModal'  name='<?php echo $chapter_title; ?>' >delete chapter</a>