Reading text file and checkboxes - PHP
<p>Basically the code below reads in a text file and diplays it on the screen with checkboxes near each line. But now I want the user to be able to check any box and then display the selected results in a new PHP file - I thought I would have to read in the text file again and somehow refer it to the array, but I'm still stuck, so any help would be appreciated.</p>

<p>Thank you.</p>

<h2>First php file</h2>

<pre><code>&lt;?php
$filename = "file.txt";
$myarray = file($filename);
print "&lt;form action='file2.php' method='post'&gt;\n";
// get number of elements in array with count
$count = 0; // Foreach with counter is probably best here
foreach ($myarray as $line) {
  $count++; // increment the counter
  $par = getvalue($line);
  if ($par[1] &lt;= 200) {
  // Note the [] after the input name
    print "&lt;input type='checkbox' name='test[$count]' /&gt; ";
    print $par[0]." ";
    print $par[1]." ";
    print $par[2]." ";
    print $par[3]."&lt;br /&gt;\n";
  }
}
print "&lt;/form&gt;";
</code></pre>

<h2>Second php file which should display the selected results</h2>

<pre><code>&lt;?php
$filename = "file.txt";
$myarray = file($filename);
?&gt;
</code></pre>
