Div模式中的可变PHP

时间:2015-07-14 14:20:15

标签: php html mysql modal-dialog

我有一个名为$table的PHP变量,我想用这个变量显示一个模态,但它不能用

<div class="modal-dialog modal-lg">
  <div class="modal-content" value="'.$table.'">
</div>

我该如何解决这个问题?

4 个答案:

答案 0 :(得分:0)

您的PHP值必须从服务器端代码发出。仅HTML标记不会解释它们。像这样:

<div class="modal-content" value="<?php echo $table; ?>">

答案 1 :(得分:0)

试试这个,

<div class="modal-dialog modal-lg">
  <div class="modal-content" ><?php echo $table; ?></div>
</div>

答案 2 :(得分:0)

请查看我的代码

    $strSQL = "SELECT * FROM `tic_bp_xprofile_data`";
    $rs = mysql_query($strSQL);
    while($row = mysql_fetch_row($rs)){
        if($row[3] == $select){
        $users[$i] = $row[2];
            $i++;}
            }
    $strSQL = "SELECT `ID`, `display_name`, `user_nicename` FROM `tic_users`";
    $rs = mysql_query($strSQL);
    $table .= '<th><p class="letrafiltro">Usuários</p></th>';
    for($aux =0 ; $aux<=$i; $aux++){
        $rs = mysql_query($strSQL);
        $table .= '<tr>';
        while($row = mysql_fetch_row($rs)){
            if($row[0]==$users[$aux])
                $table .='<td><a class="letrafiltro" href="http://ticomia.net.br/members/'.$row[2].'/">'.$row[1].'</a></td><td><a class="avatar" href="http://ticomia.net.br/members/'.$row[2].'/">'.get_avatar( $row[0], $default, $default ).'</a></td>';
        }
        $table .= '</tr>';

            }


    echo'<button type="button" class="btn btn-primary" data-toggle="modal" data-target=".bs-example-modal-lg">Large modal</button>

<div class="modal fade bs-example-modal-lg" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel">
  <div class="modal-dialog modal-lg">
    <div class="modal-content" value="'$table'">
  </div>
  </div>
</div>

一切都在php页面内。

答案 3 :(得分:0)

尝试使用下面的代码。

<div class="modal-dialog modal-lg">
    <div class="modal-content" value="<?php echo $table; ?>">
</div>