'How to get the whole string into the input type text

        <?php               
        echo "<tr>";
        echo $dna;
        echo "<td width='120' class='textfett'>Deutscher Name</td>";
        echo "<td width='114' class='titel'><input type='text' name='dname' value=$dna   size='50' maxlength='50'></td>";
       echo "<tr>";
       ?>

if $dna is two words, only one, the first, will be used as value.



Solution 1:[1]

You are essentually outputting a single value in a chunk of HTML, so instead of doing

<?php               
        echo "<tr>";
        echo $dna;
        echo "<td width='120' class='textfett'>Deutscher Name</td>";
        echo "<td width='114' class='titel'><input type='text' name='dname' value=$dna   size='50' maxlength='50'></td>";
       echo "<tr>";
       ?>

Do this

<tr>
    <td width="120" class="textfett">Deutscher Name</td>
    <td width="114" class="titel">
       <input type="text" name="dname" value="<?= htmlentities($dna) ?>" size="50" maxlength="50">
    </td>
</tr>

You can break out of PHP or not use it at all, you don't need to echo every line you output.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1