...

View Full Version : Posting info into a txt file using PHP



Taylor_1978
12-22-2003, 12:31 PM
Can someone tell me how, or direct me to a "manual" of some sort on how to do this... My CHMOD settings are correct so that's no problem - I just have no idea how! LOL

Thanks in advance :thumbsup:

Taylor.
www.ysuperleague.com

Celtboy
12-22-2003, 01:35 PM
<?
// Get the document root
$doc_root = $HTTP_SERVER_VARS['DOCUMENT_ROOT'];

// Set file for opening
$fp = fopen("$doc_root/data.txt", 'w');

// Check if can write to file
if (!$fp) {
print 'Could not open desired file for writting';
}

// Set what will be written to file
$outputstring = "Hello World";

// Finally, write to file
fwrite($fp, $outputstring);

// Close the written file
fclose($fp);

?>

Here's the PHP manual on it:

http://lv.php.net/manual/en/function.fopen.php



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum