如何将php值发送给模态

I have a query that returns a row of values

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

and i have an href link that shows a modal when clicked

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

which shows

    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>";
    ?>

but i am having a problem in displaying the correct $chapter_title. Even when i click the delete button of the second row, it still shows the title of the first row. Please help me on what to do.

Instead of

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

Try echoing the content

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

Correction

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