Please send questions to st10@humboldt.edu .
<html>

<!-- files2.php
     
     adapted from example from PHP File section
         from W3Schools PHP tutorial,
         http://www.w3schools.com/php/php_file.asp
     adapted by: Sharon Tuttle
     last modified: 12-05-06
-->

<head>
    <title> playing with PHP and files - 2 </title>
</head>

<body>
    <h2> playing with PHP and files - 2 </h2>    

    <h3>
    <?php
        print "About to open lines_to_show.txt<br>\n";

        $fileHandle = fopen("lines_to_show.txt", "r")
	    or exit("Cannot open lines_to_show.txt<br>\n");

        print "<ul>\n";
	while (! feof( $fileHandle ) )
	{
	    $nextline = fgets( $fileHandle );

            // strlen: returns the length of a string
            // trim: returns a string with leading and trailing
	    //     spaces removed

            // here, I don't want to output blank lines...
            $trimmed_length = strlen( trim($nextline));

            if ( $trimmed_length > 0 )
            {
	        print "<li> $nextline </li>\n";
            }
	}
        print "</ul>\n";

        // remember to close file when you are done!

        fclose($fileHandle);
    ?> 
    </h3>

</body>
</head>