Read a line from text file in PHP
Reading a specific line from text file and display it in HTML Page This blog demonstrates how to read a specific row from a text file and display the details in an HTML page using PHP. You can find the demo1.php, states.txt files in the previous tutorials. demo1.php states.txt demo2.php <html> <head> <title>Coding-zon tutorials</title> </head> <body bgcolor=""> <center> <br /><br /><br /><br /> <?php print "<br> <h2>State Information</h2><br />" ; $file = file ( 'states.txt' ); $row = "" ; if ( isset ( $_POST [ 'submit' ])) { $stateID = $_POST [ 'stateID' ]; //user selects from downdown foreach ( $file as $row ){ $cols = explode ( ';' , $row ); if ( $cols [ 0 ] == $stateID ){ echo "<table border='1'>" ; echo "<tr><td>State Name :</td><