fopen() to open a File
Posted: Tue Aug 26, 2003 2:25 am
Hi,
I have created a form to gather information from customer orders such as information and addresses and i`m trying to setup fopen() to open a text file for this I would like the folder that contains this text file to be C:\Program Files\Apache Group\Apache\Docs .. I got the following code from a website and would like to know if i`m headed in the right direction:
I am using PHP version 4.0.4pl with apache 2.0 and apache 1.3 ...
Also i`m abit new but would like to know if its possible to create a new page and access this file from the new page or can I add this to my processorder.php page that i have already created...
thx
This is the code i`ve found :
I edited to get this:mod_edit: added
I have created a form to gather information from customer orders such as information and addresses and i`m trying to setup fopen() to open a text file for this I would like the folder that contains this text file to be C:\Program Files\Apache Group\Apache\Docs .. I got the following code from a website and would like to know if i`m headed in the right direction:
I am using PHP version 4.0.4pl with apache 2.0 and apache 1.3 ...
Also i`m abit new but would like to know if its possible to create a new page and access this file from the new page or can I add this to my processorder.php page that i have already created...
thx
This is the code i`ve found :
Code: Select all
<?php
$fr = fopen('/tmp/test.txt', 'a+');
if(!$fr) {
echo "Error! Couldn't open the file.";
} else {
// $fr now can be used to represent the opened file
}
if(!fclose($fr)) {
echo "Error! Couldn't close the file.";
}
?>Code: Select all
<?php
$fr = fopen(C:\Program Files\Apache Group\Apache\Docs\orders.txt', 'a+');
if(!$fr) {
echo "Error! Couldn't open the file.";
} else {
// $fr now can be used to represent the opened file
}
if(!fclose($fr)) {
echo "Error! Couldn't close the file.";
}
?>Code: Select all
tags[/size]