一个按钮的onclick函数不能在php变量中工作

时间:2015-10-23 23:29:16

标签: php html materialize

我正在尝试将html + materialize css代码存储在php变量中,并将其打印在屏幕上。我还有一个带有onclick功能的按钮。但onclick功能不起作用。当用户点击按钮时,它不会调用它应该调用的php函数。

$s='<div class="container">
            <div class="card hoverable">
                <div class="card-content activator waves-effect waves-block waves-light">
                <table>
                    <tr><td><h1 class="card-title activator grey-text text-darken-4" id="content"> Cnumber:</h1></td><td><h1 class="card-title activator grey-text text-darken-4">'.$brow["id"].'</h1></td></tr>
                    <tr><td><p class="card-title activator grey-text text-darken-4">river:</p></td><td><p class="card-title activator grey-text text-darken-4">'.$brow["river"].'</p></td></tr>
                   <tr><td> <p class="card-title activator grey-text text-darken-4">Type:</p></td><td><p class="card-title activator grey-text text-darken-4">'.$brow["type"].'</p></td></tr>
                    <tr><td><p class="card-title activator grey-text text-darken-4">People:</p></td><td><p class="card-title activator grey-text text-darken-4">'.$people_count.'</p></td></tr>
                    </table>
                </div>
                <div class="card-reveal">
                    <span class="card-title grey-text text-darken-4">People<i class="material-icons right">close</i></span>
                    <p class="card-title grey-text text-darken-4">'.$people_list.'</p>
                    <button class="btn waves-effect waves-light" onclick="set_session()" id='.$brow["cab_id"].'>Share</button>
            </div>
            </div>
            </div>';
            echo $s;

1 个答案:

答案 0 :(得分:0)

<button class="btn waves-effect waves-light" onclick="set_session()" id='.$brow["cab_id"].'>Share</button>

set_session()在这里像js函数一样处理。