fwrite()

fwrite()

am 08.11.2005 09:27:06 von JC Botha

------=_NextPart_000_0006_01C5E44E.FD8522B0
Content-Type: text/plain;
charset="us-ascii"
Content-Transfer-Encoding: 7bit

Dear Users, thanks for those that helped me last time! I got it working.



At the moment I'm stuck with the fwrite() function. If I use the $_POST to
get the data out of a textbox into a var, and write it to a txt file I get
the following problem. The very first encounter it makes with a "\n" it
stops the string. Thus I do not get more than one paragraph into my txt
file. What should I do to bypass this?



Thanks


------=_NextPart_000_0006_01C5E44E.FD8522B0--

Re: fwrite()

am 08.11.2005 12:32:12 von Rosty Kerei

Maybe you need to replace "\n" to "\r\n"? Like -

$_POST['textbox'] = str_replace("\n", "\r\n", $_POST['textbox']);

Sincerely,
Rosty Kerei
rosty.kerei@gmail.com


""JC Botha"" wrote in message
news:437061a9.1e58b55b.2fbe.7755@mx.gmail.com...
> Dear Users, thanks for those that helped me last time! I got it working.
>
>
>
> At the moment I'm stuck with the fwrite() function. If I use the $_POST to
> get the data out of a textbox into a var, and write it to a txt file I get
> the following problem. The very first encounter it makes with a "\n" it
> stops the string. Thus I do not get more than one paragraph into my txt
> file. What should I do to bypass this?
>
>
>
> Thanks
>
>

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

RE: Re: fwrite()

am 08.11.2005 21:51:00 von JC Botha

Dear Rosty

Thanks for your input, but it does not change the situation at all! :(
Please let me know if there is something else that you think about.

Greetings

JC

-----Original Message-----
From: Rosty Kerei [mailto:rosty.kerei@gmail.com]
Sent: 08 November 2005 01:32 PM
To: php-windows@lists.php.net
Subject: [PHP-WIN] Re: fwrite()

Maybe you need to replace "\n" to "\r\n"? Like -

$_POST['textbox'] = str_replace("\n", "\r\n", $_POST['textbox']);

Sincerely,
Rosty Kerei
rosty.kerei@gmail.com


""JC Botha"" wrote in message
news:437061a9.1e58b55b.2fbe.7755@mx.gmail.com...
> Dear Users, thanks for those that helped me last time! I got it working.
>
>
>
> At the moment I'm stuck with the fwrite() function. If I use the $_POST to
> get the data out of a textbox into a var, and write it to a txt file I get
> the following problem. The very first encounter it makes with a "\n" it
> stops the string. Thus I do not get more than one paragraph into my txt
> file. What should I do to bypass this?
>
>
>
> Thanks
>
>

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

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

Re: Re: fwrite()

am 08.11.2005 22:24:14 von Kevin Smith

--------------ms060308010301000208030308
Content-Type: multipart/alternative;
boundary="------------080906020606050009030001"

This is a multi-part message in MIME format.
--------------080906020606050009030001
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Submit you're code to the list and let's see if we can help you.

JC Botha wrote:
> Dear Rosty
>
> Thanks for your input, but it does not change the situation at all! :(
> Please let me know if there is something else that you think about.
>
> Greetings
>
> JC
>
> -----Original Message-----
> From: Rosty Kerei [mailto:rosty.kerei@gmail.com]
> Sent: 08 November 2005 01:32 PM
> To: php-windows@lists.php.net
> Subject: [PHP-WIN] Re: fwrite()
>
> Maybe you need to replace "\n" to "\r\n"? Like -
>
> $_POST['textbox'] = str_replace("\n", "\r\n", $_POST['textbox']);
>
> Sincerely,
> Rosty Kerei
> rosty.kerei@gmail.com
>
>
> ""JC Botha"" wrote in message
> news:437061a9.1e58b55b.2fbe.7755@mx.gmail.com...
>
>> Dear Users, thanks for those that helped me last time! I got it working.
>>
>>
>>
>> At the moment I'm stuck with the fwrite() function. If I use the $_POST to
>> get the data out of a textbox into a var, and write it to a txt file I get
>> the following problem. The very first encounter it makes with a "\n" it
>> stops the string. Thus I do not get more than one paragraph into my txt
>> file. What should I do to bypass this?
>>
>>
>>
>> Thanks
>>
>>
>>
>
>

--------------080906020606050009030001
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit







Submit you're code to the list and let's see if we can help you.



JC Botha wrote:

type="cite">
Dear Rosty

Thanks for your input, but it does not change the situation at all! :(
Please let me know if there is something else that you think about.

Greetings

JC

-----Original Message-----
From: Rosty Kerei []
Sent: 08 November 2005 01:32 PM
To:
Subject: [PHP-WIN] Re: fwrite()

Maybe you need to replace "\n" to "\r\n"? Like -

$_POST['textbox'] = str_replace("\n", "\r\n", $_POST['textbox']);

Sincerely,
Rosty Kerei



""JC Botha"" wrote in message
...


Dear Users, thanks for those that helped me last time! I got it working.



At the moment I'm stuck with the fwrite() function. If I use the $_POST to
get the data out of a textbox into a var, and write it to a txt file I get
the following problem. The very first encounter it makes with a "\n" it
stops the string. Thus I do not get more than one paragraph into my txt
file. What should I do to bypass this?



Thanks










--------------080906020606050009030001--

--------------ms060308010301000208030308
Content-Type: application/x-pkcs7-signature; name="smime.p7s"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="smime.p7s"
Content-Description: S/MIME Cryptographic Signature

MIAGCSqGSIb3DQEHAqCAMIACAQExCzAJBgUrDgMCGgUAMIAGCSqGSIb3DQEH AQAAoIIH8TCC
AlMwggG8oAMCAQICAw9CczANBgkqhkiG9w0BAQQFADBiMQswCQYDVQQGEwJa QTElMCMGA1UE
ChMcVGhhd3RlIENvbnN1bHRpbmcgKFB0eSkgTHRkLjEsMCoGA1UEAxMjVGhh d3RlIFBlcnNv
bmFsIEZyZWVtYWlsIElzc3VpbmcgQ0EwHhcNMDUwODA2MDA0MTM5WhcNMDYw ODA2MDA0MTM5
WjBHMR8wHQYDVQQDExZUaGF3dGUgRnJlZW1haWwgTWVtYmVyMSQwIgYJKoZI hvcNAQkBFhVr
ZXZpbkBuZXRzbWl0aC5sdGQudWswgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJ AoGBANAryLvL
L/eiVGyDJsB2jz40lBMpD+r5as8oeTI97Mlbq+0tBcM0O/tfC05Jv7dO2XTe yyZsyjUf/9Q4
dfGKNVoNc58gxgW7aAZ28l8iBwi61HYhXTBHByU2o3ub2sPamtW2dQiPO2eV hhz5MdE5bvrB
oTbIyNWSqGxpSRv7HHn7Ag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AAAAAAAA
--------------ms060308010301000208030308--

RE: Re: fwrite()

am 09.11.2005 07:36:57 von JC Botha

------=_Part_7855_27845578.1131518217828
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

I greatly appreciate your help! Thank you so much.

if ($_POST[update] == "update") {

//write info to file

$file_data =3D "editdate#".date('l d_m_Y')."\n";

$file_data .=3D "createdate#$_POST[createdate]\n";

$file_data .=3D "title#$_POST[title]\n";

$file_data .=3D "description#$_POST[description]\n";

$file_data .=3D "sender#$_POST[sender]\n";

$file_data .=3D "letter#$_POST[letter]\n";

$file_data .=3D "response#$_POST[response]\n";

addslashes($file_data);

$file_data =3D str_replace("\n", "\r\n", $file_data);

$id =3D $_GET['id'];

$file_location =3D "letters/$id";

if (is_writable($file_location))

{

if (!$handle =3D fopen($file_location, 'w'))

{

echo "Cannot open file ($file_location)";

exit;

}

$_POST['textbox'] =3D str_replace("\n", "\r\n", $_POST['textbox']);

if (fwrite($handle, $file_data) ===3D FALSE)

{

echo "Cannot write to file ($file_location)";

exit;

}

fclose($handle);

} else {

echo "The file $file_location is not writable";

}

}

------------------------------

*From:* Kevin Smith [mailto:kevin@netsmith.ltd.uk]
*Sent:* 08 November 2005 11:24 PM
*To:* odegos@gmail.com
*Cc:* 'Rosty Kerei'; php-windows@lists.php.net
*Subject:* Re: [PHP-WIN] Re: fwrite()

Submit you're code to the list and let's see if we can help you.

JC Botha wrote:

Dear Rosty

Thanks for your input, but it does not change the situation at all! :(

Please let me know if there is something else that you think about.
Greetings

JC



-----Original Message-----

From: Rosty Kerei [mailto:rosty.kerei@gmail.com ]

Sent: 08 November 2005 01:32 PM

To: php-windows@lists.php.net

Subject: [PHP-WIN] Re: fwrite()



Maybe you need to replace "\n" to "\r\n"? Like -



$_POST['textbox'] =3D str_replace("\n", "\r\n", $_POST['textbox']);



Sincerely,

Rosty Kerei

rosty.kerei@gmail.com

""JC Botha"" wrote in message

news:437061a9.1e58b55b.2fbe.7755@mx.gmail.com...

Dear Users, thanks for those that helped me last time! I got it working.

At the moment I'm stuck with the fwrite() function. If I use the $_POST to

get the data out of a textbox into a var, and write it to a txt file I get

the following problem. The very first encounter it makes with a "\n" it

stops the string. Thus I do not get more than one paragraph into my txt

file. What should I do to bypass this?

Thanks

------=_Part_7855_27845578.1131518217828--

Re: Re: fwrite()

am 09.11.2005 09:56:44 von Rosty Kerei

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


"JC Botha" 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";

}

}

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