Is there anyway to make a form(which i already have made) that will write the values(info entered) into a txt file on the server?
edit
or create a html file into a .htaccess directory with the info
Is there anyway to make a form(which i already have made) that will write the values(info entered) into a txt file on the server?
edit
or create a html file into a .htaccess directory with the info
Ad space - for sale, $19.95/month
Here's the documentation on how to create/open files in php.
Start there and post any questions you may have.
- Brian
heh
$handle = fopen ("/path/to/file/test.txt", "w");
How will that line know what i want it to write into test.txt ?
Ad space - for sale, $19.95/month
All that line does is open the file for writing
The Rules
Was another WDF member's post helpful? Click the like button below the post.
Admin at houseofhelp.com
Suppose your form has only one field, "name" and the output needs to go into a file, "test.txt", here is code for that:
PHP Code:
<?
$name = htmlspecialchars($_POST['name']);
$fp = fopen("test.txt","a");
// a is for append, as opposed to w,
// which will overwrite the entire file
// every time you open it.
fwrite($fp, $name."\n"); // one name per line.
fclose($fp);
?>
There and Back Again :Ogre:
ahh yes, thank you very much, seems exactly like what i need, ill try it and edit this post as to if it works or not![]()
Ad space - for sale, $19.95/month
Depending on your platforms / editors the end of line character might cause problems. If your file ends lines with a square (or other weird character), try different ascii characters.
The ascii values for the end of line characters are:
Windows chr(13) . chr(10)
Linux chr(10)
Mac chr(13)
Might do good to set a couple vars. Being a C++ guy I have always had a fondness for
$endl = chr(13) . chr(10);
decided to go with mail() seems easier, thx to all that replied.![]()
Ad space - for sale, $19.95/month