I have everything with my table working correctly EXCEPT one row of the table is not working.
The row that says: Do you think Liverpool can win the League this year? is not working like the other rows. All the other rows show the number of yes answers and the % but this row does not work like those (I get a box that isn’t a box for the table, no number of yes answers and no % for this row).
Here is my php code:
[php]
Liverpool Survey<?php
$watchEPL = 0;
$liverpoolFan = 0;
$winners = 0;
$count = 0;
$surveyFile = fopen("liverpoolSurvey.txt", "r");
$nextSurvey = fgets($surveyFile);
print("<h1>Liverpool Survey Results</h1>");
print ("<table border = \"1\"> ");
print("<tr><th>QUESTION</th><th>COUNT</th><th>PERCENTAGE</th></tr>");
while(!feof($surveyFile))
{
list($watchEPL, $liverpoolFan, $winners) =
explode(":",$nextSurvey);
$count = $count + 1;
if($watchEPL == "Yes")
{
$totalWatchEPL = $totalWatchEPL + 1;
}
if($liverpoolFan == "Yes")
{
$totalLiverpoolFan = $totalLiverpoolFan + 1;
}
if($winners == "yes")
{
$totalWinners = $totalWinners + 1;
}
$nextSurvey = fgets($surveyFile);
}
fclose($surveyFile);
$percentSurvery = ($count/$count) * 100;
$percentWatchEPL = ($totalWatchEPL/$count) * 100;
$percentLiverpoolFan = ($totalLiverpoolFan/$count) * 100;
$percentTotalWinners = ($winners/$count) * 100;
print("<tr><td>Do you watch English Premier League football?</td>
<td>$totalWatchEPL</td>
<td>".number_format($percentWatchEPL,2)."%</td></tr>");
print("<tr><td>Are you a Liverpool fan?</td>
<td>$totalLiverpoolFan</td>
<td>".number_format($percentLiverpoolFan,2)."%</td></tr>");
print("<tr><td>Do you think Liverpool can win the League this year?</td>
<td>$totalWinners</td>
<td>".number_format($percentTotalWinners,2)."%</td></tr>");
print("<tr><td>TOTAL NUMBER OF SURVEYS RECEIVED</td><td>$count</td>
<td>".number_format($percentSurvery,2)."%</td></tr>");
print("</table>");
?>
<p><a href = "projectSurvey.html">Return to the Liverpool Survey form</a></p>
[/php]
Thanks a lot for your help. You guys have been a life saver several times
Jason