在不使用AJAX的情况下将PHP变量传递给Modal

在不使用AJAX的情况下将PHP变量传递给Modal,php,twitter-bootstrap,Php,Twitter Bootstrap,我有一张这样的桌子: <table class="table table-striped mb30" id="table1"> <thead> <tr> <th>#</th> <th>Player Name</th> <t

我有一张这样的桌子:

<table class="table table-striped mb30" id="table1">
                <thead>
                  <tr>
                    <th>#</th>
                    <th>Player Name</th>
                    <th>PlayerUID</th>
                    <th>Humanity</th>
                    <th>Alive</th>
                    <th></th>
                  </tr>
                </thead>
                <tbody>
                  <?php
                  while ($row = mysql_fetch_assoc($playerTable)) {
                    echo '
                      <tr>
                        <td>'.$row['characterID'].'</td>
                        <td>'.$row['PlayerName'].'</td>
                        <td>'.$row['PlayerUID'].'</td>
                        <td>'.$row['Humanity'].'</td>
                    ';
                    if ($row['Alive'] === '1') {
                      echo '<td>Yes</td>';
                    } else {
                      echo '<td>No</td>';
                    }
                    echo '
                        <td class="table-action">
                          <a href="" id="edit-row" data-toggle="modal" data-target=".bs-example-modal-lg"><i class="fa fa-pencil"></i></a>
                          <a href="" class="delete-row"><i class="fa fa-trash-o"></i></a>
                        </td>
                      </tr>
                    ';
                  }
                  ?>
                </tbody>
            </table>
当用户单击时

他们得到了一个模态的提示,现在我想把$row['characterID']传递给模态,但是我在做这件事时遇到了困难,你能推荐一个不是AJAX的好例子的方法吗

我应该提到的是,我希望通过一种可以在模式中使用PHP轻松找到的方式来传递它,即$\u GET、$\u POST、$\u SESSION等等


提前谢谢

您可以将该ID设置为另一个数据属性

echo '<td class="table-action">
    <a href="" id="edit-row"
        data-toggle="modal"
        data-target=".bs-example-modal-lg"
        data-character-id="' . $row['characterID'] . '">
    <i class="fa fa-pencil"></i></a>
</td>';

现在,您可以将该信息传递到事件回调中的模式中,该模式处理锚定单击。

您不能。看,PHP在服务器上运行,点击客户端。当您进入浏览器时,PHP只不过是一个固定文本或标记字符串。如果要再次运行服务器上的内容,可以刷新屏幕、转到新URL或通过HttpRequest发送ajax查询。