+ Reply to Thread
Results 1 to 9 of 9

Thread: Download/Save Textarea

  1. #1
    driveflexfuel is offline x10 Sophmore driveflexfuel is an unknown quantity at this point
    Join Date
    Jul 2008
    Posts
    159

    Download/Save Textarea

    I have a php Script that creates forms and functions depending on what my customers click on in a form. The results are displayed in 2 or 3 text areas. I have been looking every where and i can not find a code to do the following properly.

    I want to have a save button under each textarea that allows them to save it locally without saving it on my server.

    I have no problem using php cookies or JS to accomplish this. If anyone could help it is greatly appreciated

  2. #2
    descalzo's Avatar
    descalzo is offline Grim Squeaker descalzo has a brilliant futuredescalzo has a brilliant futuredescalzo has a brilliant future
    Join Date
    Jul 2009
    Location
    Ankh-Morpork
    Posts
    7,636

    Re: Download/Save Textarea

    Quote Originally Posted by driveflexfuel View Post
    The results are displayed in 2 or 3 text areas.

    I want to have a save button under each textarea that allows them to save it locally without saving it on my server.
    'textareas' , as in textarea input boxes?

    'save locally', as in save to their hard disk? Save it for the session?
    Nothing is always absolutely so.

  3. #3
    driveflexfuel is offline x10 Sophmore driveflexfuel is an unknown quantity at this point
    Join Date
    Jul 2008
    Posts
    159

    Re: Download/Save Textarea

    Text areas as in <textarea cols=10 rows=5>Bla Bla Bla</textarea>

    Locally I mean they click on the save button and they can save it to their desktop or other directory.

  4. #4
    galaxyAbstractor's Avatar
    galaxyAbstractor is offline Community Advocate galaxyAbstractor is on a distinguished road
    Join Date
    Oct 2007
    Location
    Land of Null and Insanity
    Posts
    5,495

    Re: Download/Save Textarea

    Like saving it to a .txt file? Or to a cookie?

  5. #5
    driveflexfuel is offline x10 Sophmore driveflexfuel is an unknown quantity at this point
    Join Date
    Jul 2008
    Posts
    159

    Re: Download/Save Textarea

    To a txt, html, js or php files

  6. #6
    descalzo's Avatar
    descalzo is offline Grim Squeaker descalzo has a brilliant futuredescalzo has a brilliant futuredescalzo has a brilliant future
    Join Date
    Jul 2009
    Location
    Ankh-Morpork
    Posts
    7,636

    Re: Download/Save Textarea

    Something like this page ?
    Nothing is always absolutely so.

  7. #7
    driveflexfuel is offline x10 Sophmore driveflexfuel is an unknown quantity at this point
    Join Date
    Jul 2008
    Posts
    159

    Re: Download/Save Textarea

    That is exactly what I'm looking for.

  8. #8
    descalzo's Avatar
    descalzo is offline Grim Squeaker descalzo has a brilliant futuredescalzo has a brilliant futuredescalzo has a brilliant future
    Join Date
    Jul 2009
    Location
    Ankh-Morpork
    Posts
    7,636

    Re: Download/Save Textarea

    The form:

    HTML Code:
    <form name="form1" id="form1" action="testback.php" method="POST" target="_blank">
    <textarea id="area" name="area" rows="5" cols="25">
    Some stuff here to save add your text
    </textarea>
    <input type="submit" value="Save As" name="submit" id="submit">
    </form>
    testback.php (probably should use $_POST or $_GET, make sure it is set, etc).

    PHP Code:
    <?php

    header
    'Content-disposition: attachment; filename=yourInfo.txt' );

    $mess $_REQUEST['area'] ;

    echo 
    $mess ;

    ?>
    Haven't tested it on all browsers. I vaguely recall reading somewherethat there might be a samll issue with IE for Mac.
    Nothing is always absolutely so.

  9. #9
    driveflexfuel is offline x10 Sophmore driveflexfuel is an unknown quantity at this point
    Join Date
    Jul 2008
    Posts
    159

    Re: Download/Save Textarea

    Im not worried it works in IE and FF for windows and that is about 98% of my viewers. If it does not work in others they will just have to copy and paste the code.

    Thank you for all your help
    Last edited by driveflexfuel; 09-08-2009 at 05:12 PM.

+ Reply to Thread

Similar Threads

  1. textarea and link
    By liguehs in forum Programming Help
    Replies: 12
    Last Post: 07-31-2009, 04:07 PM
  2. PHP textarea problems
    By djcustom in forum Programming Help
    Replies: 6
    Last Post: 04-09-2009, 06:29 PM
  3. Replies: 7
    Last Post: 11-20-2008, 06:54 AM
  4. TEXTAREA cgiemail problem
    By arthurjw in forum Free Hosting
    Replies: 0
    Last Post: 08-05-2008, 09:05 PM
  5. How do you make a textarea with a scrollbar?
    By Album in forum Tutorials
    Replies: 10
    Last Post: 10-23-2005, 04:17 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers