Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 8 of 8
  1. #1
    Senior Member krazy's Avatar
    Join Date
    Apr 2003
    Location
    California
    Posts
    543
    Member #
    1078
    Is there anyway to make a form(which i already have made) that will write the values(info entered) into a txt file on the server?

    edit
    or create a html file into a .htaccess directory with the info
    Ad space - for sale, $19.95/month

  2.  

  3. #2
    Senior Member skrlin's Avatar
    Join Date
    Apr 2003
    Location
    Illinois
    Posts
    562
    Member #
    1063
    Here's the documentation on how to create/open files in php.

    Start there and post any questions you may have.
    - Brian

  4. #3
    Senior Member krazy's Avatar
    Join Date
    Apr 2003
    Location
    California
    Posts
    543
    Member #
    1078
    heh
    $handle = fopen ("/path/to/file/test.txt", "w");

    How will that line know what i want it to write into test.txt ?
    Ad space - for sale, $19.95/month

  5. #4
    WDF Staff Wired's Avatar
    Join Date
    Apr 2003
    Posts
    7,656
    Member #
    1234
    Liked
    137 times
    All that line does is open the file for writing
    The Rules
    Was another WDF member's post helpful? Click the like button below the post.

    Admin at houseofhelp.com

  6. #5
    Senior Member nsr81's Avatar
    Join Date
    Oct 2002
    Posts
    1,132
    Member #
    250
    Liked
    15 times
    Suppose your form has only one field, "name" and the output needs to go into a file, "test.txt", here is code for that:
    PHP Code:
    <?
    $name 
    htmlspecialchars($_POST['name']);

    $fp fopen("test.txt","a");  
    // a is for append, as opposed to w, 
    // which will overwrite the entire file 
    // every time you open it.
    fwrite($fp$name."\n"); // one name per line.
    fclose($fp);
    ?>
    There and Back Again :Ogre:

  7. #6
    Senior Member krazy's Avatar
    Join Date
    Apr 2003
    Location
    California
    Posts
    543
    Member #
    1078
    ahh yes, thank you very much, seems exactly like what i need, ill try it and edit this post as to if it works or not
    Ad space - for sale, $19.95/month

  8. #7
    Senior Member tibberous's Avatar
    Join Date
    Aug 2003
    Posts
    195
    Member #
    2535
    Depending on your platforms / editors the end of line character might cause problems. If your file ends lines with a square (or other weird character), try different ascii characters.

    The ascii values for the end of line characters are:

    Windows chr(13) . chr(10)
    Linux chr(10)
    Mac chr(13)

    Might do good to set a couple vars. Being a C++ guy I have always had a fondness for

    $endl = chr(13) . chr(10);

  9. #8
    Senior Member krazy's Avatar
    Join Date
    Apr 2003
    Location
    California
    Posts
    543
    Member #
    1078
    decided to go with mail() seems easier, thx to all that replied.
    Ad space - for sale, $19.95/month


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 04:34 AM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com