I'm new to HTML and when I searched for various ways of reading a text file inside HTML file, I found this code :
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Page Title</title>
</head>
<body>
<?php
$myfile = fopen("C:\Users
uh\Documents\webdictionary.txt", "r") or die("Unable to open file!");
echo fgets($myfile);
fclose($myfile);
?>
</body>
</html>
The PHP code does not run inside HTML.
Using javascript, I could not find a code which reads each line into a variable. Please suggest me another way to read the contents into a variable.