What are the common pitfalls when trying to combine PHP variables with HTML links?

When combining PHP variables with HTML links, a common pitfall is forgetting to properly concatenate the variables within the link. To solve this issue, make sure to enclose the variable within curly braces and concatenate it with the rest of the link using the dot operator. Example:

<?php
  $id = 123;
  $link = "example.com?id={$id}";
?>
<a href="<?php echo $link; ?>">Click here</a>