View Full Version : guestbook, htmlentities nl2br
samik
03-09-2002, 12:30 PM
take a look at my guestbook:
http://home.no.net/teksttv/guestbook/gjestebok.php?action=skriv
there`s an "error" with my htmlentities (or) nl2br..
any idea?
thanks, kim aka samik
spaz109ca
03-09-2002, 12:41 PM
I can't read whatever language it is in.
samik
03-09-2002, 01:10 PM
spaz109ca: if you dont know what language it is, I dont need your help ;)
what about looking the filename? gjestebok.php :)
scoutt
03-09-2002, 02:58 PM
I don't see a problem. did you fix it already? also you don't have any <html> tags so you might have a problem with the whole page itself.
samik
03-09-2002, 03:27 PM
No fix yet :(
As I thought <html> didn`t help.
The guestbook itself is fine, the problem comes whenever you type a new line (enter/return) then the result is: Hello<BR><BR>Whats up?
// When specialchars are to be replaced...
$comment=htmlentities($comment);
$name=htmlentities($name);
$url=htmlentities($url);
$email=htmlentities($email);
$bosted=htmlentities($bosted);
// When ASCII Linebreaks should become <br>s
$comment = nl2br($comment);
You see?
scoutt
03-09-2002, 03:32 PM
why are you using htmlentities?
use htmlspecialchars();
$comment=htmlspecialchars($comment);
$name=htmlspecialchars($name);
$url=htmlspecialchars($url);
$email=htmlspecialchars($email);
$bosted=htmlspecialchars($bosted);
and then use
$comment = ereg_replace("(\r\n|\n|\r)", "<br>", $comment);
vBulletin® v3.6.7, Copyright ©2000-2009, Jelsoft Enterprises Ltd.