使用PHP显示html时使用多个引号连接

时间:2015-06-15 05:13:36

标签: php html concatenation

请协助在这里进行连接

    echo"<form class='navbar-form navbar-left' role='search' method='POST' action='addr3.php'>
    <input type="hidden" name="id_delete" value="'.$id_r.'">
    <button type='submit' class='btn btn-primary'> I am Roaming </button>
    </form>";

3 个答案:

答案 0 :(得分:0)

某些'未正确使用。改变这个 -

value="'.$id_r.'"value='" . $id_r . "'

type="hidden"type='hidden'

name="id_delete"name='id_delete'

整个代码将是 -

echo "<form class='navbar-form navbar-left' role='search' method='POST' action='addr3.php'>
<input type='hidden' name='id_delete' value='" . $id_r . "'>
<button type='submit' class='btn btn-primary'> I am Roaming </button>
</form>";

答案 1 :(得分:0)

请确保您不要以同样的方式使用'",这应该有效:

echo "<form class='navbar-form navbar-left' role='search' method='POST' action='addr3.php'>
<input type='hidden' name='id_delete' value='".$id_r."'>
<button type='submit' class='btn btn-primary'> I am Roaming </button>
</form>";

答案 2 :(得分:0)

只需撤消你的报价。

<?php
echo '<form class="navbar-form navbar-left" role="search" method="POST" action="addr3.php">
        <input type="hidden" name="id_delete" value="'.$id_r.'">
        <button type="submit" class="btn btn-primary"> I am Roaming </button>
    </form>';
?>