use php to produce a text file from the browser

Links for php scripts

Moderators: macek, egami, gesf

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

Post by Joel » 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);
fclose($fp5);

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

Who is online

Users browsing this forum: Baidu [Spider] and 1 guest