I think you might be looking for an array. I've rewritten part of you code with an array. I have created a file on my server called info_gen.txt with the following 5 lines in it:
line 1
line 2
line 3
line 4
line 5
The while function adds each line to the array. Once the while is finished I then have it echo each individual item from the array. I have it change the second line from info_gen.txt in the array to Hello World, then echo it.
Here is a live example using the code below. http://code.chadayers.org/helper/1.php
Is this what you are looking for?
<?php
$console = $_GET["console"];
$name = $_GET["name"];
$ar = array();
$file = fopen("info_gen.txt", "r") or exit("Unable to open file!");
//Output a line of the file until the end is reached
while(!feof($file))
{
$ar[] = fgets($file);
}
fclose($file);
echo $ar[0]. "<br />";
$ar[1] = "Hello World";
echo $ar[1]. "<br />";
echo $ar[2]. "<br />";
echo $ar[3]. "<br />";
echo $ar[4]. "<br />";
?>