Jump to content

writing to a txt file


perezf

Recommended Posts

i need help desperately
I need a way where i can have a user type information into a form and submit it
after it is submited it should be saved to the server and ready to see
writing to a txt file
can someone help
Link to comment
Share on other sites

I am having probs with Fopen as well.
Recieving this error when attempting to write to textfile

PHP Warning: fopen(TS345.txt) [function.fopen]: failed to open stream: Permission denied in c:\Inetpub\wwwroot\index.php on line 135 PHP Warning: fputs(): supplied argument is not a valid stream resource in c:\Inetpub\wwwroot\index.php on line 235 PHP Warning: fclose(): supplied argument is not a valid stream resource in c:\Inetpub\wwwroot\index.php on line 137 PHP Warning: mail() [function.mail]: SMTP server response: 550 5.7.1 Unable to relay for the_only_uglytroll@shaw.ca in c:\Inetpub\wwwroot\index.php on line 170
Link to comment
Share on other sites

[!--quoteo(post=384082:date=Jun 15 2006, 12:49 AM:name=perezf)--][div class=\'quotetop\']QUOTE(perezf @ Jun 15 2006, 12:49 AM) [snapback]384082[/snapback][/div][div class=\'quotemain\'][!--quotec--]
i need help desperately
I need a way where i can have a user type information into a form and submit it
after it is submited it should be saved to the server and ready to see
writing to a txt file
can someone help
[/quote]

Hi,
Try with this
[code]
function savefile($filename,$content)
{
    if (!$handle = fopen($filename, 'w')) {
         echo "Cannot open file ($filename)";
         exit;
    }

    if (fwrite($handle, $content) === FALSE) {
        echo "Cannot write to file ($filename)";
        exit;
    }


    fclose($handle);
    return true;
}
[/code]
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.