Make PHP echo <a href= link>

html, mysql, php

Solution

<?php echo <a

You need to pass a string to `echo`. You can't just start writing HTML in the middle of PHP.

That said, it is generally easier to minimise the amount of HTML in PHP in HTML that you can.

<td>
    <a href='edit-dispatch-report.php?id=<?php echo $row['ID']; ?>'>
        <?php echo $row['ID']; ?>
    </a>
</td>

Problem

I'm trying to make a value that is retrieved using `$row` hyperlinked to another page, but I can't figure out why it isn't working. The area specifically is; ``` <td><?php echo $row["ID"]; ?></td> ``` Here is what I am using; ``` <td> <?php echo <a href='edit-dispatch-report.php?id=" . $row['ID'] . "' >" . $row['ID'] . "</a>; ?> </td> ``` How come that doesn't work?

Original source