Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Jun 2008
    Posts
    47
    Thanks
    7
    Thanked 0 Times in 0 Posts

    Flat File Problems

    PHP Code:
    <?php
    $fileName 
    "z" $_POST['Keyword'] . ".txt";
    $file fopen($fileName,"w");

    fwrite($file,$string);

    $string =     "Name: "$_SESSION['name'] . "\nGender: " $_SESSION['gender'] . "\nClass: " $_SESSION['class'] . "\nGauld: " $_SESSION['gold'] . "\nLocation: " $_SESSION['location'] . "\nStrength: " $_SESSION['str'];

    fclose($file);
    ?>
    All of the variables are pre-set. However, when I run the source, it creates a file but does not write to it. I am confused.

    Is there something I'm doing wrong?

  • #2
    bdl
    bdl is offline
    Regular Coder
    Join Date
    Apr 2007
    Location
    Camarillo, CA US
    Posts
    590
    Thanks
    4
    Thanked 83 Times in 82 Posts
    Move $string up above the function call that uses it.


  •  

    Posting Permissions

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