Pass on to simple txt file

Hi to all
I’m about 1/4 light year away from understanding that php language, thanks for your help.
I am building a little application in between a flash project, a bit of php and text file.

So here it is,
I am sendind my variables from my flash file with

compteur_lv = new LoadVars();
page1_btn.onRelease = function() {
compteur_lv.val = val1;
compteur_lv.loadVariables(“compteur.php”, “POST”);
};

So I was hoping the compteur.php file would get that val variable and pass it on to the “checker.txt” with this little bit of magic:

<?php
$val= $_POST[“val”];
$filename = ‘checker.txt’;
$handle = fopen($filename, ‘w+’);
fwrite($handle, ‘$val’);
?>
but then, nothing happens in my checker.txt

Thanks for your help.
Fabrice