twitter bootstrap模式只与js一起使用

Implemented in PHP using Codeigniter, I am using Twitter Bootstrap Modal for my project. The goal is that when I click the modal, an entry form for the name will appear. Fortunately, the modal gets the data I need (i.e. the name of the community). However, when I load the modals one by one, it is only in the first modal that my code here works:

Here are my codes inside my view page together with the codes linked above:

//..code here

<?php foreach ($name_list as $list) { ?>

modal trigger

<img class="pointer" title="Edit" src="pic.png" data-toggle="modal" data-target="<?php echo "#" . $list->name?>"/> <?php echo $list->name?>

modal

<div class="modal fade bs-example-modal-sm" id="<?php echo $list->name ?>" tabindex="-1" role="dialog" aria-labelledby="mySmallModalLabel" aria-hidden="true">
    <div class="modal-dialog modal-sm">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                <h4 class="modal-title" id="myModalLabel">Edit <?php echo $list->name?></h4>
            </div>

            <form action="<?php echo base_url();?>edit" method="post">
                <div class="modal-body">
                    <b><p id="warning"></p></b>
                    <input name="edit-name" id="edit-name" type="text" placeholder="Name" value="<?php echo $list->name?>"/>
                    <input name="edit-id" type="text" value="<?php echo $list->id?>" class="hidden"/>
                </div>

                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
                    <input type="submit" id="edit-btn" disabled="true" class="btn btn-primary" value="Save changes" />
                </div>
            </form>

        </div>
    </div>
</div>

What is wrong with my code? Why does my JS code work only once?