Track number of times radio button is selected and store in text file for PHP
<p>Hey this is my first post so I hope I am approaching this properly but anyway, I have a survey in which a user is presented with 8 questions and they are supposed to rate how they feel about each question by clicking the radio buttons valued from 1(strongly disagree)-5(strongly agree).  So what I need to do is record the frequency in which each radio button is selected.  Something like this:</p>

<pre><code>$filename = "Results.txt";
$lines = file($filename); 
$q1 = $_POST['q1'];
$q2 = $_POST['q2'];
$q3 = $_POST['q3'];
$q4 = $_POST['q4'];
$q5 = $_POST['q5'];
$q6 = $_POST['q6'];
$q7 = $_POST['q7'];
$q8 = $_POST['q8'];

foreach($lines as $line) {  
        echo $line;
        if (isset($q1)){
            echo $line[$q1];
            echo $lines;
        }
    }
</code></pre>

<p>Where q represents question#.
Lastly this needs to keep a running calc and the results.txt should look something like this:<br/>
0,0,5,0,0 <br/>
0,0,0,0,0 <br/>
0,0,0,0,0 <br/>
0,0,0,0,0 <br/>
0,0,0,0,0 <br/>
0,0,0,0,0 <br/>
0,0,0,0,0 <br/>
0,0,0,0,0 <br/>
The 5 in line one means 5 users submitted a neutral radio button option (value 3).  Each line represents the tally for each question.</p>

<p>Please help!</p>
