PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Wednesday, November 2, 2022

[FIXED] How to open make hyperlink for txt files

 November 02, 2022     file, fopen, html, php, txt     No comments   

Issue

I created 3 text files and I want to create a bullet form list with hyperlinks that will direct the user to each file created. How can I code this?

echo "<ul>";
echo "<li>" . <a fopen("test.txt", "r") or die("Unable to open file!");>Test 1</a>  "</li>";
echo "<li>"  . $filename = 'test2.txt' . "</li>";
echo "/<ul>";

Solution

Please note that /<ul> is not the correct closing tag, it should be </ul>

On the other hand, you may use the Nowdoc string quoting syntax (or similar):

<?php
echo <<<'EOD'

<ul>
<li><a href='test.txt'>Test1</a></li>
<li><a href='test2.txt'>Test2</a></li>
</ul>

EOD;

?>

For further reference on the above , please view the official documentation:

http://docs.php.net/manual/en/language.types.string.php#language.types.string.syntax.nowdoc



Answered By - Ken Lee
Answer Checked By - Robin (PHPFixing Admin)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing