php echo中需要帮助按钮href

时间:2018-12-07 23:56:39

标签: php button onclick href

我有以下代码行:

//onclick="location.href='http://www.example.com'"
echo "<button type='button' class='single_add_to_cart_button button alt wdm_enquiry' style='background:rgb(0, 171, 0) none repeat scroll 0% 0%';>Ihre ".$post_name." Testversion anfordern!</button>";

onclick需要包含在回显中,但是我不能这样做。

有人可以帮我吗?

1 个答案:

答案 0 :(得分:1)

您可以这样写:

function buscarCategs() {

    global $con;

    $buscar_categ = "SELECT * FROM categorias";

    $run_categ = mysqli_query($con, $buscar_categ);

    $id=1;

    while ($row_categs = mysqli_fetch_array($run_categ)) {

        $categ_id = $row_categs['categ_id'];
        $categ_titulo = $row_categs['categ_titulo'];

        echo "<li id=\"idselector_$id\" class='celulaCategoriasMenu' onmouseover='javascript:showMenu(); ' onmouseout='javascript:hideMenu();'>$categ_titulo</li><div id='linkMenuAbre' class='linkMenuAbre'>Teste</div>";
        $id++;
    }
}