HTML: Save text on server?
5 posts
Page 1 of 1
Hello. I need help with a little project:
There's a website with a textbox and a submit button. When the user clicks the submit button the text should be saved into a txt file on the server. I remember doing such a thing a very long time ago and php was involved too but now I forgot it and there don't seem to be any good answers on google either. Can you help with it?
There's a website with a textbox and a submit button. When the user clicks the submit button the text should be saved into a txt file on the server. I remember doing such a thing a very long time ago and php was involved too but now I forgot it and there don't seem to be any good answers on google either. Can you help with it?
This is a signature.
Hello,
This code should work:
-Filip
This code should work:
Code: Select all
KR<?
if ($_POST && $_POST['nameoffield']!="") {
file_put_contents("path/to/file.txt", $_POST['nameoffield']."\n", FILE_APPEND);
}
?>
<form method="post">
<input type="text" name="nameoffield" />
<input type="submit" value="Submit" />
</form>
-Filip
CodenStuff wrote:Nope, it's just your sick and dirty mind. You sick twisted warped little pervo
For some reason, the text file stays empty. The text file is in the same folder as the index.php so I set the path to something like 'file.txt'
This is a signature.
dj1437 wrote:For some reason, the text file stays empty. The text file is in the same folder as the index.php so I set the path to something like 'file.txt'Edit: forgot to CHMOD it! Working now! Thanks a lot.
This is a signature.
You're welcome,
If you need any help, feel free to ask.
-Filip
If you need any help, feel free to ask.
-Filip
CodenStuff wrote:Nope, it's just your sick and dirty mind. You sick twisted warped little pervo
5 posts
Page 1 of 1
Copyright Information
Copyright © Codenstuff.com 2020 - 2023