use php to produce a text file from the browser

Links for php scripts

Moderators: egami, macek, gesf

Post Reply
New php-forum User
New php-forum User
Posts: 193
Joined: Sat Mar 29, 2003 11:57 pm
Location: Auckland, New Zealand

Sun Mar 30, 2003 12:06 am

here is a code i use.

//Name the the variable of $text is what you put in the form field called "totext".

$text = $_POST["totext"]

//Define what is to be sent to the text file

$topost = "<p>$text</p>"

//Send it to the text file.

$fp5 = fopen("textfile.txt", 'w');
fwrite($fp5, $topost);

the w means to write to the file, this over writes anything in there. to make it add to the bottom, change the w to a.

you have to be careful with php characters also, with things like " and / and '.

Post Reply