Help with writing to text file: basic php may be

I’m trying to write some text to a text file. Actually, i retrieved the text from the file simply without using any PHP, so i thought there might be a way to write back to it without PHP too. Is there?? i couldn’t find any through flash help files though…

Anyways, so i started trying to use PHP for it. I wrote some code so that it took some text from a dynamic text box on stage, and would write it into a text file in a folder inside the one which contains the swf and the php file.

here is the code:
Actionscript:


//Inside the button i press to send the code:
 
on(release)
{
 var data_lv:LoadVars = new LoadVars();
 var send_lv:LoadVars = new LoadVars();
 data_lv.notes = _root.notesCont.nt.inside.notepad.notes_txt.text;
 
//i know thats a lot of nesting of movieclips, but the path is fine
//i checked.
 
 send_lv.sendAndLoad("notesPhp.php",data_lv);
}
 

here’s the php code in notesPhp.php file located in the same folder.


<?php
$nValue = $_POST['notes'];
$filename = "/userName/myNotes.txt";
$handle = fopen($filename, "w"); 
fwrite($handle, "$nValue");
fclose($handle);
?>

But the file myNotes doesnt get written… Its inside the userName directory. Where is the mistake? i am very new to php so i have no clue what might be going wrong there. i might be writing the path incorrectly or anything
Also, i dont really get the hang of sendAndLoad function. As in, why i need to use the data_lv object necessarily.
So how exactly DO i send the text from a dynamic text box to a file??
Is there some way around php for this too??
Whats wrong with this code?