I have a textarea in a separate frame from the frame my PHP is in. As far as I know, if I want to dynamically set the values of the textarea upon loading the php page, I have to use both PHP and JavaScript. Here is what I have now:
echo '<script type="text/javascript"><!--
parent.otherFrame.document.formName.fieldName.value="', $comment, '";
// -->
</script>';
The problem is that when $comment contains any kind of line breaks, the JavaScript won't execute. I have tried nl2br(), but '<br />' will just show up in the textarea, instead of actual line breaks. I read that in order to have JavaScript put line breaks in a field, you need to use '\r\n' where the breaks would be
$comment = 'This is the first line\r\nThis is the second'
But I can't get PHP to output any new line characters as '\r', '\n', or '\r\n'. I have tried almost every string function available, but It's not working. :mad:
Any thoughts?