concatenation with multiple quotes while displaying html using PHP

90 views Asked by At

Please assist in doing concatenation here

    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

There are 3 answers

1
Peter On BEST ANSWER

Make sure you dont use ' and " in the same way, this should work:

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
Sougata Bose On

Some 's are not correctly Used. Change this -

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

type="hidden" to type='hidden'

name="id_delete" to name='id_delete'

The whole code will be -

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>";
0
Rasclatt On

Just reverse your quotes.

<?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>';
?>