how do i write to a text file on the server

Hi .. i am quite new to php so any help would be much appreciated..what i need to do is send a string to a text file on the server so that i can then display the contents of this text file in a html page..is this possible??? i have looked at the fwrite and fread commands and it looks as though they could do this ???

Comments

  • Try this:

    <?PHP
    fp = fopen("filename.blah", a);
    fwrite(fp, "this is the string, or a string variable");
    fclose(fp);
    ?>

    I have not actually tried this particular code, but it should work. Give it a try, and play around with it, it's the best way to learn! Good Luck!

    James

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

In this Discussion