How to read txt file into Html Table
Read content or data from text file and write it into HTML Table This tutorial explains How to read the contents of a text file and write it into an HTML table using PHP Scripting. Below, there are two files : 1. states.txt: All the data is separated with semicolon(;). Create states.txt and copy below content and save it in a project folder. 2. demo.php: Reads the sates.txt file, displays the data in a table. Create it and save in the same project folder. Start server and open it in a browser. You can see the output as shown in the image down below. The content of the text file is as follows: states.txt 1;Alabama;Montgomery;5,024,279 2;Alaska;Juneau;733,391 3;Arizona;Phoenix;7,151,502 4;Arkansas;Little Rock;3,011,524 5;California;Sacramento;LosAngeles;3,914,4818 MOVETOP↑ Code explanation: 1. for each loop, reads each row from the file 2. explode function takes two parameters 3. The first one is the character you want to separate(delimiter)...