how to display the result in a table using PHP : i have PHP code that read from txt files and display the result  where the user enter a word for search and the system read the files and display the result with specified the line number and the file name.

i want to display these result in a table or a form that is well formed.

if its possible columns must be the name of files and the rows contains the line number.

code:
=======

    <?php
    
    
    if(isset($_POST["search"]))
            {
                $search =$_POST['name'];
                echo "the word  $search exist: <br><br>";
                foreach(glob($_SERVER['DOCUMENT_ROOT']."/readfiletest/*.txt") as $txts)
                {
    				$line = 1; 
                    $myFileLink = fopen($txts, 'r');
                    while(!feof($myFileLink)) 
                    {
                    $myFileContents = fgets($myFileLink);
                    if( preg_match_all('/('.preg_quote($search,'/').')/i', $myFileContents, $matches))
                    {
    
                            foreach($matches[1] as $match)
                            {
    						
    							
                                 echo "line [$line] file  ";
                            }
                            echo basename ($txts) . "<br>".PHP_EOL;
                    
                    }
                    ++$line;
                    }
                fclose($myFileLink);
                }
            }
    ?>
    
    
    <html>
        <head>
    	</head>
    	<meta http-equiv="Content-Language" content="ar-sa">
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    	<style>
    	      #form {
            background: -webkit-linear-gradient(bottom, #CCCCCC, #EEEEEE 175px);
            background: -moz-linear-gradient(bottom, #CCCCCC, #EEEEEE 175px);
            background: linear-gradient(bottom, #CCCCCC, #EEEEEE 175px);
            margin: auto;
            width: 200px;
            height: 200px;
            position: absolute;
    
    
            font-family: Tahoma, Geneva, sans-serif;
            font-size: 14px;
            font-style: italic;
            line-height: 24px;
            font-weight: bold;
            color: #09C;
            text-decoration: none;
            border-radius: 10px;
            padding: 10px;
            border: 1px solid #999;
            border: inset 1px solid #333;
            -webkit-box-shadow: 0px 0px 8px rgba(0, 0, 0, 0.3);
            -moz-box-shadow: 0px 0px 8px rgba(0, 0, 0, 0.3);
            box-shadow: 0px 0px 8px rgba(0, 0, 0, 0.3);
          }
    
    	</style
    	<body>
    	<div id = "form">
            <form action="index.php" method="post">
              <h1 align =center > Search Form </h1>
    		  <p>enter your string <input type ="text"  id = "idName"  name="name" /></p>
              <p align =center ><input type ="Submit" name ="search" value= "Search" /></p>
            </form>
    	</div>
        </body>
    </html>

