April 7th, 2000, 01:46 PM
I have a textarea in my form with the database field schema corresponding to it defined as longtext. My problem is that the information I am entering into the textarea has to be entered using <br> tags.
I am making entries of possible majors in the textarea. So I have to type in...
... to make everything print out in a separate line. I have been told there's an easier way to do this -- by using the nl2br() function in PHP.
Does anyone know about this? How is it implemented and how does it work?
Any help is much appreciated since I don't want my data entry person wasting time with <br> tags for every new line.
April 7th, 2000, 02:48 PM
In the script where you process the form, before entering in the database just do:
and insert the $now_br variable into the table
April 9th, 2000, 02:36 PM
April 12th, 2000, 08:08 PM
Another way is ofcourse to use the nl2br() AFTER a MySql fetch, before you are going to display it, like:
$arr = nl2br($row->something);
This leaves the database free of html tags, which makes later editing of the post less anoying (especially in longer text files)