greetings,

I am learning the basics of file processing, starting w/ how to write data to a file. 
So far, I've created the .txt file and wrote the code. This is all being done on my 
local windows 2k PC for practice. My question is, where should I save the .txt file? 
So far, my forms and .php files are in the www directory. To open the file in PHP, I'm 
using the fopen() function. Below is the code I've writen:

//info to be writen to file 

$outputstring = $date."\t".$_POST["luminaireqty"]." luminairs \t" 
  .$_POST['coffeeqty']." coffee tables \t".$_POST['hallqty'].
  " hall tables \t\$".$total ."\t". $address."\n";

  // open file for appending
  @ $fp = fopen("../../orders/orders.txt", "a");

    flock($fp, 2);

    if (!$fp)
    {
      echo "<p><strong> Your order could not be processed at this time.  "
           ."Please try again later.</strong></p></body></html>";
      exit;
    }

    fwrite($fp, $outputstring);
    flock($fp, 3);
    fclose($fp);

   echo "<p>Order written.</p>";


Thanks,

Patrick

 



----------------
"forget your lust for the rich man's gold. All that you need, is in your soul. You can 
do this if you try. All that I want for you my son, is to be satisfied"

  ~ Lynard Skynard

Reply via email to