Board index   FAQ   Search  
Register  Login
Board index PHP PHP Scripts

use php to produce a text file from the browser

Links for php scripts

Moderators: macek, egami, gesf

use php to produce a text file from the browser

Postby ill2000m » Sat Mar 29, 2003 8:47 am

hello, i would like to ask is there any way that php could transfer whatever display on the broswer to a text file?? e.g in a form if i type "reset" in the textfield and the word"reset" would produce in a text file ??
ill2000m
New php-forum User
New php-forum User
 
Posts: 3
Joined: Sat Mar 29, 2003 8:38 am

Postby 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 '.
Joel
New php-forum User
New php-forum User
 
Posts: 193
Joined: Sat Mar 29, 2003 11:57 pm
Location: Auckland, New Zealand


Return to PHP Scripts

Who is online

Users browsing this forum: Bing [Bot] and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.