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 4 of 4
  1. #1
    New to the CF scene
    Join Date
    Mar 2010
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Help in a php coding problem !!

    Hello i`m running a website for my workshop , i would like to make a forum that will have 2 text boxes and one button .
    The first text box will be called : Suggestion: [Text box] , under this one there will be one called: E-mail: [Text box] , and under this one will be a Send button .
    Now is the question , i will want users to type their suggestions in the text boxes , and when they press the Send button , to automaticly write the suggestion and the e-mail in a text document , each suggestion and e-mail separated by a line , and allways adding a new line in the same document , withouth erasing the previous suggestions etc . Sorry for my bad languace , i`m waiting, for your responses, thank you .

  • #2
    Senior Coder Len Whistler's Avatar
    Join Date
    Jul 2002
    Location
    Vancouver, BC Canada
    Posts
    1,323
    Thanks
    26
    Thanked 100 Times in 100 Posts
    Not fully tested and will need some fine tuning.


    PHP Code:
    <?php
    $comments 
    $_POST['comments'];
    $email $_POST['email'];

    $myFile "data.txt";
    $fh fopen($myFile'a') or die("can't open file");
    fwrite($fh"$comments\n");
    fwrite($fh"$email\n ---------------------------");
    fclose($fh);
    ?>
    <form method="post" action="index.php">
    <input type="text" name="email"><br>
    <textarea rows="8" cols="105" name="comments"></textarea><br>
    <input type="submit" value="Submit" name="submit">
    </form>

    ---------------
    Leonard Whistler

  • #3
    Senior Coder
    Join Date
    Apr 2010
    Posts
    1,419
    Thanks
    68
    Thanked 102 Times in 101 Posts
    Why wouldn't you want to use a database? why to a text file? Curious...

  • #4
    New to the CF scene
    Join Date
    Mar 2010
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    i dont have a database , and for something this simple , i dont want to make a datebase ..
    or is there anyoter way .. like making a javescript code.. submitLoginForm() that will take the data from Comments and e-mail and put them in a text document?


  •  

    Posting Permissions

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