|
Posted by Ivαn Sαnchez Ortega on 06/07/06 07:52
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Wayne wrote:
> $a = $_POST['txt_content']; # txt_content = This is a<CR><LF>Test
> $p = str_replace ("%0D%0A", "<br>", $a);
- From what language did you come from? "%0D%0A" is not a valid syntax to
specify ascii characters in a string. Please have a read:
http://es.php.net/manual/en/language.types.string.php#language.types.string.syntax.double
And, if you want to check for CR-LF, plus CR alone, plus LF alone, you may
want to pass an array to str_replace:
str_replace( array("\r\n","\r","\n") , '<br>' , $subject);
Alternatively:
str_replace( array("\0x0d\0x0a","\0x0d","\0x0a") , '<br>' , $subject);
Alternatively:
str_replace( array(chr(13).chr(10) , chr(13) , chr(10)) , '<br>' ,
$subject);
And, most important:
nl2br($subject);
- --
- ----------------------------------
IvΓ‘n SΓ‘nchez Ortega -i-punto-sanchez--arroba-mirame-punto-net
http://acm.asoc.fi.upm.es/~mr/ ; http://acm.asoc.fi.upm.es/~ivan/
MSN:i_eat_s_p_a_m_for_breakfast@hotmail.com
Jabber:ivansanchez@jabber.org ; ivansanchez@kdetalk.net
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.3 (GNU/Linux)
iD8DBQFEhoW/3jcQ2mg3Pc8RAn61AJoD2RxamjK7QTy80onOP9clKHMijgCfVKQt
uY/ZtXUSqrp9ek/vH5bttk4=
=U92G
-----END PGP SIGNATURE-----
Navigation:
[Reply to this message]
|