What is the correct way to echo a link to another page in php? I have seen this used but it doesn't work?
echo "<p><a href=\"link\">";
Html in PHP
<?php
echo "<a href='$link'>The Link You Want</a>";
?>
Php in Html
<a href="<?php echo $link;?>"> Link </a>
It seems like your question was already answered in How to create a link to another PHP page
<a href="index.php">Index Page</a>
<a href="page2.php">Page 2</a>
If you need to pass a value -
<a href="page2.php?val=1">Link that pass the value 1</a>
You would do it like this:
print("<a href='your_target'></a>");
Or if you want to print the code and not the link:
print(htmlspecialchars("<a href='your_target'></a>"));
try this:
<a href='<?php echo "the_page_you_want.php" ?>'>link_text</a>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.