Re: Re: fwrite()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx>


"JC Botha" <odegos@xxxxxxxxx> wrote in message 
news:ed268d8c0511082236t48508501w8912229b8c628c35@xxxxxxxxxxxxxxxxx
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";

}

}

-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Database Programming]     [PHP Install]     [Kernel Newbies]     [Yosemite Forum]     [PHP Books]

  Powered by Linux