Cotoatl Posted October 13, 2005 Share Posted October 13, 2005 Since im still new to PHP , I'd like to know how to save the contents of a textbox or the following return value TrResult inside a notepad text archive in C:/ <form name="SourceOfTranslation" action="http://www.systranet.com/systran/net" method="post" enctype="multipart/form-data" id="SourceOfTranslation"><input type="hidden" name="s" value="TrResult">Any ideas?I would also apreciate some code to name the text archive and choose a path to save it . Link to comment Share on other sites More sharing options...
jherzog Posted October 13, 2005 Share Posted October 13, 2005 Since im still new to PHP , I'd like to know how to save the contents of a textbox or the following return value TrResult inside a notepad text archive in C:/ <form name="SourceOfTranslation" action="http://www.systranet.com/systran/net" method="post" enctype="multipart/form-data" id="SourceOfTranslation"><input type="hidden" name="s" value="TrResult">Any ideas?I would also apreciate some code to name the text archive and choose a path to save it .<{POST_SNAPBACK}> Is this something you want the script to do automaticly? If you want the user to be able to choose the path to save the text file you can do something like this:<?php //Retrieve your variable to make the body of the text file $body=$_POST['TrResult']; //This header designates that the page is a text file for download header("Content-type: text/plain"); //This header names the file header("Content-Disposition: attachment; filename=filename.txt"); header("Pragma: no-cache"); header("Expires: 0"); //The following print function will create the body of the text file print " $body ";?>Going to this page will present the user with a "Save as" box and allow them to save the file where they normally would. The file is a plain text file with the name you designate on line 9.Not sure if this is what you wanted, let me know.Jed Link to comment Share on other sites More sharing options...
jherzog Posted October 13, 2005 Share Posted October 13, 2005 whoops I called your variable value not your variable name. So the fourth line should be: $body=$_POST['s']; Link to comment Share on other sites More sharing options...
Cotoatl Posted October 14, 2005 Author Share Posted October 14, 2005 Well, that certainly is useful, but not excatly what I need. As you asked before, I need the scripts to do it automaticaly.What I need is the TrResult value to be stored straight into my hardisk as a .TXT file. TrResult actually contains a few lines of text, because its used to store a translation between lenguajes. While choosing a name for the file would be ideal, I dont mind to use a preset file to save the results (as long as it doesnt overwrite whatever is already stored). If you still dont know exactly what I want, you could share some code to save the contents of a texbox inside a specific text file (either on html or php), and I would be much in your debt. Link to comment Share on other sites More sharing options...
jherzog Posted October 15, 2005 Share Posted October 15, 2005 Yeah I am not sure if I can help you any further. I am certainly not as skilled in PHP as some. If you want the scipt to automatically write a file to your HD (verus the web server's drive) I think you might find that hard to impossible (I think, I don't know). I could see security issues if scripts were able to do that. You could write a cookie which is a text file but then it will go to the cookie folder. Sorry I couldn't help more, hopefully someone more skilled with join the discussion. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now