If you are not registered or logged in, you may still use these forums but with limited features. Show recent topics
  [Search] Search   [Hottest Topics] Hottest Topics   [Members]  Member Listing   [FAQ]  FAQ 
[Register] Register / 
[Login] Login 
write to a txt file in php been working on this for a week  XML
Forum Index » Support Forum
Author Message
dbztoolkit
Beginner

Joined: 21/08/2003 02:37:14
Messages: 6
Offline

I need this to right the form content to the txt file if you know how help me please ive been trying for a week

this is the form in message.php
<?php
<form name="form1" method="post" action="messageboard.php" >
<input type="name" name="name" value="name"> </form>
?>
this is the messageboard.php

<?php
$filename = 'mail.txt';
$somecontent = ("test this is what is posted to mail.txt");

// Let's make sure the file exists and is writable first.
if (is_writable($filename)) {

// In our example we're opening $filename in append mode.
// The file pointer is at the bottom of the file hence
// that's where $somecontent will go when we fwrite() it.
if (!$handle = fopen($filename, 'a')) {
print "Cannot open file ($filename)";
exit;
}

// Write $somecontent to our opened file.
if (!fwrite($handle, $new)) {
print "Cannot write to file ($filename)";
exit;
}

print "Success, wrote ($new) to file ($filename)";

fclose($handle);

} else {
print "The file $filename is not writable";
}
?>

whats up need help
Anonymous



try this, doesn't work let me know

this is the messageboard.php
 
Forum Index » Support Forum
Go to:   
Based on the open source JForum