php :: new line in textarea?

后端 未结 10 1988
暖寄归人
暖寄归人 2020-12-09 09:02

How do you create a new line in a textarea when inserting the text via php?

I thought it was \\n but that gets literally printed in the textarea.

<
10条回答
  •  攒了一身酷
    2020-12-09 09:48

    PHP Side: from Textarea string to PHP string

    $newList = ereg_replace( "\n",'|', $_POST['theTextareaContents']);
    

    PHP Side: PHP string back to TextArea string:

    $list = str_replace('|', '
    ', $r['db_field_name']);
    

提交回复
热议问题