Jump to content


Photo

Writing to txt files


  • Please log in to reply
1 reply to this topic

#1 komquat

komquat
  • Members
  • PipPipPip
  • Advanced Member
  • 130 posts
  • LocationHoughton, MI

Posted 10 April 2006 - 05:59 PM

Could someone please point me in the direction of a good tutorial/demo/guide for writing php POST info to a .txt file.

Thanks in advance

#2 kenrbnsn

kenrbnsn
  • Staff Alumni
  • Advanced Member
  • 8,235 posts
  • LocationHillsborough, NJ, USA

Posted 10 April 2006 - 06:05 PM

It really depends on what information you want to put in the file and how you want it to appear. If you just want to dump all the information in the $_POST array into the file, you can do:
<?php
$fp = f open('textfile.txt','w');
f write($fp, print_r($_POST,true) . "\n");
f close($fp);
?>

(remove the spaces in the function names)

Ken




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users