Results 1 to 2 of 2

Thread: PHP Form that creates a File

  1. #1
    NLC LSComputers's Avatar
    Join Date
    Oct 2005
    Location
    Oakville, ON
    Posts
    2,112
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    PHP Form that creates a File

    Hello Guys,

    Been a while, I've been trying to develop a PHP form that will on submit create two files in specific folders. I've never done this but based on what I have read this shouldn't be difficult. I'm hoping someone can point me in the right direction:

    PHP Form Options:

    New Customer: YES | NO
    ---> This will create a file user.txt

    Name: TEXT BOX
    Product: OPTION 1 | OPTION 2 | OPTION 3
    ----> These will create a file order.txt

    This would be created in one form ideally on one page however could be configured under two if required. I found:
    http://php.about.com/od/advancedphp/..._write_php.htm

    But I'm not an expert in this field and need a jumping off point.
    Regards,
    Josh Dargie
    Programmer and Web Hosting Professional

    Marketing - IT Solutions - Business Consulting

  2. #2
    NLC wswd's Avatar
    Join Date
    Dec 2010
    Posts
    1,425
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    This will create the file if it doesn't exist:

    <?php
    $File = "YourFile.txt";
    $Handle = fopen($File, 'w');
    ?>


    This will write data to it:

    <?php
    $File = "YourFile.txt";
    $Handle = fopen($File, 'w');
    $Data = "Jane Doe\n";
    fwrite($Handle, $Data);
    $Data = "Bilbo Jones\n";
    fwrite($Handle, $Data);
    print "Data Written";
    fclose($Handle);
    ?>
    WSWD Inc., Celebrating our 18th year in business
    WSWD.net - Shared, Reseller, VPS, Dedicated Server Hosting
    Blazing Fast SSD VPS That Will Blow Your Mind!! High Performance RAID10 SSD Drives, IPv4, IPv6, and Private IPs
    InstaFree.com - Fast, Reliable Hosting...For FREE!

Similar Threads

  1. How to create an file with form?
    By zerocool786 in forum Programming Help
    Replies: 5
    Last Post: May 23rd, 2006, 14:47
  2. File Upload to Form and out to Email
    By jamieb100 in forum Programming Help
    Replies: 0
    Last Post: July 3rd, 2002, 10:35
  3. file send via form, how?
    By is0lized in forum Webdesign / HTML
    Replies: 1
    Last Post: February 28th, 2002, 13:08
  4. php form processing to a text file..
    By crj in forum Programming Help
    Replies: 5
    Last Post: January 22nd, 2002, 22:07
  5. php form processing to a txt file....
    By crj in forum Webdesign / HTML
    Replies: 1
    Last Post: January 22nd, 2002, 15:55

Bookmarks

Posting Permissions

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