Hello, I seen to be having some trouble with mixing JavaScript and PHP.
I'm trying to make a 'Like System', sort of like Digg, and I thought it would be easy; ask the user if they like it of not, if they click no, subtract one value, if they like it, add one value. Value = 1.
Here's the code:
PHP Code:
$reviewIDrating = "rIDRatings/reviewID-$reviewID-rating.txt";
$myFile = "$reviewIDrating";
$fh = fopen($myFile, 'w') or die("can't open file");
$stringData = "STUFF TO WRITE TO FILE";
fwrite($fh, $stringData);
fclose($fh);
echo "
<select id='likemeter'>
<option class='listdata' value='1'>Like</option>
<option class='listheader' value='-1'>Dislike</option>
</select>
<script type='text/javascript'>
function writeit() {
document.write(document.getElementById('likemeter').value);
}
</script>
<input type='button' onclick='writeit()' value='WriteIt' />
";
The first part jsut opens the file (or creates one) according to the URL Parameter 'reviewID'. Then it writes 'STUFF TO WRITE TO FILE' in it, then closes it.
The second part, the JS, simply lets you select if you 'Like' or 'Dislike' the review. Then you click 'WriteIt', and it writes it to a blank page. All fine and dandy. That works, woohoo...
My problem is making it write what the user selected ('Like' or 'Dislike') to the file, instead of 'STUFF TO WRITE TO FILE'. I
m mixing client and server side scripting, and it's very tough.
Sorry, and thanks
-PG
Oh, and I've read all over that ActiveXObject or whatever does this sort of thing, but it only works on Windows, and you have to have weird sl2 (IDK) on you computer, so it won't work on a Mac or Linux...I happen to run Linux, my friend has a Mac, so both of us can't even test it... Please no ActiveXObject answers

.