php-n00b Posted February 24, 2009 Share Posted February 24, 2009 Whats ^ ppl? Anyway, Im a complete Newbie to php so please go easy on me lol. So basically how do i save inputed data to a file either on the server or my pc. Thanks Bye. Link to comment https://forums.phpfreaks.com/topic/146705-little-php-help/ Share on other sites More sharing options...
Zhadus Posted February 24, 2009 Share Posted February 24, 2009 Welcome to the PHP world. Please be more descriptive in the future though and google is your friend. It's a generous morning though, so: <?php $file = "testfile.txt"; $fh = fopen($file, 'w') or die("Unable to Open"); $data = "Input Goes Here"; fwrite($fh, $data); fclose($fh); ?> That will open testfile.txt or create it if it doesn't exist and write $data to it. The "w" portion in the fopen means it will overwrite anything already in there. This will be putting it in the same directory of the page that's running it. Link to comment https://forums.phpfreaks.com/topic/146705-little-php-help/#findComment-770228 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.