PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
i would like to ask that i have a <textarea> and in that i can insert 3 lines. i want to that 3 lines ouput should come with a break after each line. means i just want to add <br> after each line ouput.
the name of <textarea> is shipping_detail.
Hi,
if you hit 'enter' in a textbox, this line break is represented by \n (Unix System) or \r\n (Windows) or \r.
One solution is to replace \r\n, \n and \r by <br>, but the better solution is to use nl2br:
echo nl2br($value_from_textbox);
Hannes2k wrote:Hi,
if you hit 'enter' in a textbox, this line break is represented by \n (Unix System) or \r\n (Windows) or \r.
One solution is to replace \r\n, \n and \r by <br>, but the better solution is to use nl2br:
echo nl2br($value_from_textbox);
hi
here is what i tried. but i gets error "error inserting product"
If i m wrong then correct me. do i have to add nl2br where i m writing echo $value in my page or where i have inserted it in my above code.
i m little confuse.
Hi,
no, I is better to use nl2br only on the output. Just insert the orginal value into your database and when you use echo to present this data, use nl2br().
Hannes2k wrote:Hi,
no, I is better to use nl2br only on the output. Just insert the orginal value into your database and when you use echo to present this data, use nl2br().