A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: PHP to save data to a text file

  1. #1
    Senior Member
    Join Date
    May 2003
    Posts
    160

    PHP to save data to a text file

    Hey guys ... I need to know how to save varibales from flash to a text file ... Using a PHP script

    Is this possible ...

    Could someone maybe write a small script to do that ... like maybe just save one var to a text file ... and can figure out the rest ...

    thanks guys,

    -s

  2. #2
    Senior Member
    Join Date
    May 2003
    Location
    Austria
    Posts
    146
    Hi,

    Yes it is possible.

    After you have received your vars go on like this:

    PHP Code:

    $entry
    =$_POST["myvar"]
    $file="myfile.txt";
    $open=fopen($file,"a");

    if(
    $open){        
        
    fwrite($open,$entry);
            
    fclose($open);

    You have to determine a file, in this case 'myfile.txt'. Then open your file with 'fopen'. The 'a' in fopen is very important. It means that your data will be added at the end of your textfile and it creates a file if the file doesnt´t exist.
    After you have written the data (in this case the var '$entry') in your file, close the current file with 'fclose'.
    Last edited by andreaskrenmair; 09-18-2003 at 04:43 AM.

  3. #3
    Senior Member
    Join Date
    May 2003
    Posts
    160
    Makes sense, thanks man

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center