Results 1 to 4 of 4
  1. #1
    Join Date
    Feb 2012
    Posts
    2

    Question Unanswered: Need Help for creating FILE and Writing data into it

    I have some 3 or 4 variables which hold some text datas .

    I would like to have the php codes required to create a new .txt file each time the submit button is clicked and want to write all those datas in those variables to this newly created text file .

    what am I supposed to do for this to accomplish ??

    ps: im a noob in coding, detailed help will be appreciated .thanks in advance

  2. #2
    Join Date
    Apr 2005
    Posts
    29
    Here is an example to write to a file.

    Code:
    $myFile = "testFile.txt";
    $fh = fopen($myFile, 'w') or die("can't open file");
    $stringData = "Some Data\n";
    fwrite($fh, $stringData);
    $stringData = "More Data\n";
    fwrite($fh, $stringData);
    fclose($fh);
    Web Database Software - Build your own php mysql database.

  3. #3
    Join Date
    Feb 2012
    Posts
    2
    Quote Originally Posted by sonic10 View Post
    Here is an example to write to a file.

    Code:
    $myFile = "testFile.txt";
    $fh = fopen($myFile, 'w') or die("can't open file");
    $stringData = "Some Data\n";
    fwrite($fh, $stringData);
    $stringData = "More Data\n";
    fwrite($fh, $stringData);
    fclose($fh);
    bro will that create new file testFile.txt or that file shud be already present ??

  4. #4
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    Quote Originally Posted by issu View Post
    bro will that create new file testFile.txt or that file shud be already present ??
    have a look at da manuel
    I'd rather be riding on the Tiger 800 or the Norton

Posting Permissions

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