Ok, I have a form set up with the code listed below. What I'm trying to do is when the user submits the form the following happens:
1) The file with the data is opened. This will contain 2 numbers. One holding the number of votes and one with the vote total (explained in more detail later).
2) the two numbers are stored to two variables, $voteTotal and $numVotes or something like that.
3) The new vote is added to $voteTotal (its a rating script so this will be a number between 1 and 10) and $numVotes is increased by one.
4) Finally, I want to the file saved and closed. The data still stored in $numVotes and $voteTotal will be used to display an avg rating (avg = $voteTotal/$numVotes).
As you can see I have this planned out I just can't compeltely figure out how the fopen() fread() and fwrite() functions work. Any help would be appreciated. Here is the code for the form:
Thanks
1) The file with the data is opened. This will contain 2 numbers. One holding the number of votes and one with the vote total (explained in more detail later).
2) the two numbers are stored to two variables, $voteTotal and $numVotes or something like that.
3) The new vote is added to $voteTotal (its a rating script so this will be a number between 1 and 10) and $numVotes is increased by one.
4) Finally, I want to the file saved and closed. The data still stored in $numVotes and $voteTotal will be used to display an avg rating (avg = $voteTotal/$numVotes).
As you can see I have this planned out I just can't compeltely figure out how the fopen() fread() and fwrite() functions work. Any help would be appreciated. Here is the code for the form:
PHP:
<form action="process.php" method="get">
<select name="menu1" onChange="MM_jumpMenu('parent',this,0)">
<option>Rate It!</option>
<option>----------</option>
<option value="process.php?rating=1">1</option>
<option value="process.php?rating=2">2</option>
<option value="process.php?rating=3">3</option>
<option value="process.php?rating=4">4</option>
<option value="process.php?rating=5">5</option>
<option value="process.php?rating=6">6</option>
<option value="process.php?rating=7">7</option>
<option value="process.php?rating=8">8</option>
<option value="process.php?rating=9">9</option>
<option value="process.php?rating=10">10</option>
</select>
</form>
Thanks















