nbajpai nbajpai - 3 months ago 8
MySQL Question

How to give echo '<a href="view2.php?id=' . $id . '">' . $name . '</a>'; in html

i got this

<?php
'echo <a href="view2.php?id=' . $id . '">' . $name . '</a>';
?>


as working code in php but how can I use it in html ?
I want to use it as links in html

Answer

You forgot a ' after echo

echo '<a href="view2.php?id='.$id.'">'.$name.'</a>';

Also make sure your file has .php extension not .html. php only works in .php files

UPDATE

If 'echo <a href="view2.php?id=' . $id . '">' . $name . '</a>'; is what you truly have, look at the example above of where the first ' should be.

Comments