Re: Re: fwrite()

From: Date: Wed, 09 Nov 2005 08:56:44 +0000
Subject: Re: Re: fwrite()
References: 1  Groups: php.windows 
Request: Send a blank email to php-windows+get-26474@lists.php.net to get a copy of this message
Gosh! JC, I used $_POST['textbox'] as an example for you. If you wish to end your lines by "\r\n" instead of "\n" just do it, like here $file_data = "editdate#".date('l d_m_Y')."\r\n"; And if you have some textareas on your HTML form, you can change them like $_POST['textbox'] = str_replace("\n", "\r\n", $_POST['textbox']); Where 'textbox' is a name of your textarea field. Got it? Sincerely, Rosty Kerei <rosty.kerei@gmail.com> "JC Botha" <odegos@gmail.com> wrote in message news:ed268d8c0511082236t48508501w8912229b8c628c35@mail.gmail.com... I greatly appreciate your help! Thank you so much. if ($_POST[update] == "update") { //write info to file $file_data = "editdate#".date('l d_m_Y')."\n"; $file_data .= "createdate#$_POST[createdate]\n"; $file_data .= "title#$_POST[title]\n"; $file_data .= "description#$_POST[description]\n"; $file_data .= "sender#$_POST[sender]\n"; $file_data .= "letter#$_POST[letter]\n"; $file_data .= "response#$_POST[response]\n"; addslashes($file_data); $file_data = str_replace("\n", "\r\n", $file_data); $id = $_GET['id']; $file_location = "letters/$id"; if (is_writable($file_location)) { if (!$handle = fopen($file_location, 'w')) { echo "Cannot open file ($file_location)"; exit; } $_POST['textbox'] = str_replace("\n", "\r\n", $_POST['textbox']); if (fwrite($handle, $file_data) === FALSE) { echo "Cannot write to file ($file_location)"; exit; } fclose($handle); } else { echo "The file $file_location is not writable"; } }

« previous php.windows (#26474) next »