Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8766161
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T16:28:54+00:00 2026-06-13T16:28:54+00:00

I want to create a HTML page that will have a table that will

  • 0

I want to create a HTML page that will have a table that will populate itself with info from 2 .txt files that are on a remote Linux Server.
or populate a html page on that remote server with the same info from those 2 .txt files and then access that html page using apache’s webserver.

something as basic as possible would be nice but I can understand if it’s complicated to do with html

honestly, any help at all would be nice.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T16:28:55+00:00Added an answer on June 13, 2026 at 4:28 pm

    I would personally do it in PHP. You can read the file and echo it into a table. You can then use the lines of the file for anything you want. I put comments in explaining each step. All you have to do is change $filepath to point at your text file:

    Edited: Edited the code to add constraints mentioned by OG poster in comments. There is probably a more optimized way of performing your task, but this works and should introduce some new concepts to you if you are new to PHP

    <?php
        $filepath = 'files/the_file.txt';
        if (file_exists($filepath)) {
            $file = fopen($filepath, 'r');
            echo '<table border=1>';
            while (!feof($file)) {
                $line = fgets($file);
                $first_char = $line[0];
                if ($first_char != '*' && $first_char != '^' && trim($line) != '') {
                    if (strstr($line, '|')) {
                        $split = explode('|', $line);
                        echo '<tr>';
                        foreach($split as $line) {
                            echo '<td>'.$line.'</td>';
                        }
                        echo '</tr>';
                    } else {
                        echo '<tr><td>'.$line.'</td></tr>';
                    }
                }
            }
            echo '</table>';
        } else {
            echo 'the file does not exist';
        }
    ?>
    

    I’ll do my best to explain it line by line instead of flooding the scrip with comments:

    1. set your file path
    2. If the file exists, continue on. If not, throw the error located at the bottom of the script
    3. open the file
    4. create the table (‘<table>‘)
    5. while the text file is being read, do a series of things: First, get the line. If the first character of the line is a * or ^, or when the line is trimmed there are no characters, skip it completely. Otherwise, continue on
    6. if the line contains a | character, split (explode) the line at all of the | characters. Use this array of split up content and for each piece of content, echo out a new column in the existing row with the current content. Otherwise, there is not | found and you can just echo the line into a row normally
    7. once you are finished up, end the table (‘</table>‘)

    Edit #2: The original solution I posted:

    <?php
        $filepath = '/var/www/files/the_file.txt';
        if (file_exists($filepath)) {
            $file = fopen($filepath, 'r');
            echo '<table border=1>';
            while (!feof($file)) {
                $line = fgets($file);
                echo '<tr><td>'.$line.'</td></tr>';
            }
            echo '</table>';
        } else {
            echo 'the file does not exist';
        }
    ?>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to create a html page that get data from a website table
I want to create a multicolumn layout in html that will run from left
I want to create a generic html table to excel file view that can
I want to create an 'editable' table in MVC, where each row will have
I want to create a html table with a 1pt black outer border and
I have php generating html and I want to create layers. Basically I want
I have an html page with a flash object that provides video chat using
I have been given a task to create a Python file that will take
I want to create a HTML link. Such that when a link is clicked
I'm trying to create a page that will spit out a users invoices. I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.