Hello, I just started php not too long ago, but I've been coding in C/C++ for a while now so I'm picking up on it quite easily. Anyway, I wrote a script for a simple rating system.
Ex. User clicks the plus button, it raises it by 1; Clicks the Minus Button, it lowers it by 1.
The problem that I'm having is, it's raising/lowering in intervals of 2. It's only doing this in Firefox, and not in IE. I don't know what the problem is, but if someone could help me, I'd greatly appreciate it.
Here is my current code:
function rate ( )
{
$curr = @file_get_contents('./WAD_RATE.txt');
if($_GET['rate'] == 'up'){
$curr++;
$fp = fopen('./WAD_RATE.txt', 'w');
fwrite($fp, $curr);
fclose($fp);
}
elseif($_GET['rate'] == 'down'){
$curr--;
$fp = fopen('./WAD_RATE.txt', 'w');
fwrite($fp, $curr);
fclose($fp);
}
echo $curr;
return $curr;
}
Thanks in Advance for any help!