php to write user input to a text doc to my server

Discussion in 'Programming' started by kool-aid, Oct 8, 2007.

  1. #1
    I am a flash developer. As you probably know flash NEEDs php or another server side script to accomplish almost any saving or sending of data. I know how to pass my flash variables to a php doc. I do not know how to have php write a text or html doc to my server saving my user input data. Any help you wizards could give to a humble Action Script Developer would be greatly appreciated.
     
    kool-aid, Oct 8, 2007 IP
  2. GMROCKS

    GMROCKS Active Member

    Messages:
    648
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    60
    #2
    GMROCKS, Oct 8, 2007 IP
  3. kool-aid

    kool-aid Peon

    Messages:
    7
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    I have been looking through a lot of the info on that link. Thanks. Please bare with me i am a php idiot. I am learning more as time goes on, but i need to have this project done sorta yesterday. I was hoping there would be a simple solution. This is the php i use for a basic mail form. I understand this. Is there a way instead of sendTo i could say something like writeTo and then specify the file extention i would like assigned to it.

    <?php

    $sendTo = "" ;
    $subject = "";

    $sendTo2 ="";


    $headers = "From: " . $_POST["firstName"] ." ". $_POST["lastname"] . "<" . $_POST["email"] .">\r\n";

    $headers .= "Reply-To: " . $_POST["email"] . "\r\n";


    $headers .= "Return-path: " . $_POST["email"];

    $message = $_POST["phone"] . $_POST["message"];

    mail($sendTo, $subject, $message, $headers);
    mail($sendTo2, $subject, $message, $headers);


    ?>
     
    kool-aid, Oct 8, 2007 IP
  4. kool-aid

    kool-aid Peon

    Messages:
    7
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    A friend of mine gave me this code which (after configuring to my form) should do the trick. He got this code from someone at phpfreaks.com. The simple solution i needed!

    <?php
    $mode = file_exists('user_input.txt')?'a':'w'; // append if file exists otherwise create it
    $fp = fopen('user_input.txt',$mode); // open file
    fwrite($fp,print_r($_POST,true)."\r\n"); // dump the contents of the $_POST array to the file
    fclose($fp);
    ?>
     
    kool-aid, Oct 8, 2007 IP