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 3 of 3

Thread: fopen

  1. #1
    Regular Coder
    Join Date
    Jan 2007
    Posts
    123
    Thanks
    20
    Thanked 1 Time in 1 Post

    fopen

    Hello,
    I know this is simple but I can't work it out.

    So I am using an Edit in place script, and in the "update.php" file I want to make it so that it updates a txt file.
    PHP Code:
    $handle fopen($_GET['fieldname'].".txt""w+");
    fwrite($handlestripslashes($_GET['content']));
    fclose($handle);


    $fieldname $_GET['fieldname'];
    echo 
    stripslashes(strip_tags($_GET['content'],"<br><p><img><a><br /><strong><em>")); 
    Instead of the .txt file being in the root directory I want it to be in a directory called content.

    $handle = fopen($_GET['fieldname'].".txt", "w+");

    SO instead of eg homepage.txt, it would be content/homepage.txt
    How do I add this before the bolded bit above?

    Thanks

  • #2
    Senior Coder
    Join Date
    Apr 2007
    Location
    Quakertown PA USA
    Posts
    1,028
    Thanks
    1
    Thanked 125 Times in 123 Posts
    $handle = fopen("content/".$_GET['fieldname'].".txt", "w+");

  • #3
    Regular Coder
    Join Date
    Jan 2007
    Posts
    123
    Thanks
    20
    Thanked 1 Time in 1 Post
    Thank you, it works.


  •  

    Posting Permissions

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