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 5 of 5
  1. #1
    New Coder
    Join Date
    May 2005
    Posts
    19
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question How To Save Form Data To A Text File?

    There is probably a very easy answer to this question but I'm not too experienced in php and I havent done something like this before.

    I have a simple form. One field for an email adress and a submit button. When a user enters their email address and then clicks submit I would like it to save the email to a text file and then send the user to a thank you page.

    If someone could write a quick code that will do this (including the form) it would be great.

    Thanks,
    James.

  • #2
    $object->toCD-R(LP); vinyl-junkie's Avatar
    Join Date
    Jun 2003
    Posts
    3,082
    Thanks
    2
    Thanked 23 Times in 23 Posts
    Quote Originally Posted by moose05
    I would like it to save the email to a text file
    Here is a post that tells you how to write to a file using PHP.

    and then send the user to a thank you page.
    Example from the PHP manual :

    Code:
    header("Location: http://www.example.com/");
    Hope this helps.
    Music Around The World - Collecting tips, trade
    and want lists, album reviews, & more
    SNAP to it!

  • #3
    New Coder
    Join Date
    May 2005
    Posts
    19
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thank you, but I needed someone to write the full code that would do what I needed. As I said I'm not too familiar with php and I didnt know what to do with the code in that thread.

    If anyone could quickly write a short code that would do what I needed, it would be great

    Thanks.

  • #4
    Senior Coder NancyJ's Avatar
    Join Date
    Feb 2005
    Location
    Bradford, UK
    Posts
    3,172
    Thanks
    19
    Thanked 65 Times in 64 Posts
    Quote Originally Posted by moose05
    Thank you, but I needed someone to write the full code that would do what I needed. As I said I'm not too familiar with php and I didnt know what to do with the code in that thread.

    If anyone could quickly write a short code that would do what I needed, it would be great

    Thanks.
    try posting here http://www.codingforums.com/paid-work-offers-requests-now-closed/

    Seriously though, have a go. All the information you need has been provided for you, if you get stuck, post what you've got and we can help you.

  • #5
    New Coder
    Join Date
    Sep 2005
    Posts
    15
    Thanks
    0
    Thanked 0 Times in 0 Posts
    PHP Code:
    $handle fopen("filename.txt""a");
    fwrite$handle"\n" .  $_POST['email'] );
    fclose$handle ); 
    I'm not making any validation check and I'm not checking if the user already put his email in the file...I'm sure you can figure it out using these functions.


  •  

    Posting Permissions

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