line breaks removed in chrome but not firefox

Hi,

I am setting up an ecard system and the “enter your message” field should allow users to enter line breaks.

This works fine in Firefox but for some reason, they get stripped out in Chrome.

I am new to PHP to not really sure where to look. Any ideas?

Here is the link - http://feelgoodyouknowthatyoushould.com/ecard/

Thanks
Mark

Hi,

I tried your form in chrome and when I hit enter it goes to a new line. At what part do you lose your newlines?

Have you tried what
[php]
echo strpos( $textarea, “\n” ); // where $textarea contains what people filled in in the textarea
[/php]
returns?

If they’re inthere but the browser doesn’t render it the way you expected try this
[php]
$textarea = str_replace( “\n”, “
\n”, $textarea ); // idem.
[/php]

Hope it helps, ;D
O.

NB. newlines are normally rendered as spaces. Only in certain HTML elements they render as a newline ( AFAIK those are TEXTAREAs and PRE elements ). No doubt this behaviour is controlled by a stylesheet.

Thanks for your help!

Sponsor our Newsletter | Privacy Policy | Terms of Service