Showing data you got on one page on another page
Posted: Mon Jul 01, 2002 11:22 am
I've made a script for rating downloads, when people open a certain page they are able to rate the download and they get an average rating after they vote. Now i want to put up all the averages on another page to show them. How can i do this with the following script:
The main File:
And the vote.php file:
And all the votings go into a file, in the above script that is rating.dat. But for other ratings there are other *.dat files to contain the data of that rating.
And i want to put the averages ($gem variable) of more than one rating on one page. How can i do this??
The main File:
Code: Select all
<?
if($blah)
{
include "rating.dat";
$p=0;
$aantal=sizeof($cijfertjes);
for($x=0;$x<$aantal;$x++)
{
$p+=$cijfertjesї$x];
}
$gem = $p/$aantal;
echo "<b>Rating:</b> $gem";
}
else
{
?>
<br>
<FORM action="vote.php">
<select name="vote" onchange="this.form.submit()">
<option>Rate this download...
<option value=1>1
<option value=2>2
<option value=3>3
<option value=4>4
<option value=5>5
<option value=6>6
<option value=7>7
<option value=8>8
<option value=9>9
<option value=10>10
</select>
</form>
<?
}
?>Code: Select all
<?
$fp=fopen("rating.dat",a);
fputs($fp,
"<? \$cijfertjesї]=$vote; ?>");
fclose($fp);
echo "Thanks for voting!
<meta http-equiv="refresh" content="1; url=main.php?blah=ok">";
?>And i want to put the averages ($gem variable) of more than one rating on one page. How can i do this??