Glese Posted December 10, 2011 Share Posted December 10, 2011 I am intending to do a line-break in a specific division and I do manage it, though in the second division I am using pre tags, because I need the submitted data to be as is. Here is an example: <!-- The Contribution Description --> <tr> <td colspan="3"><div class="break_word"><p><?php echo $contribution_description; ?></p></div></td> </tr> <!-- The Separation Line --> <tr> <td colspan="3"></td> </tr> <!-- The Contribution --> <tr> <td colspan="3"><div class="break_word"><pre><?php echo $contribution; ?></pre></div></td> </tr> </table> I am wondering, how can I manage to still have the line-break working as in the first division, and still keep the pre tags intact? Link to comment https://forums.phpfreaks.com/topic/252914-do-a-line-break-even-with-the-pre-tag/ Share on other sites More sharing options...
premiso Posted December 11, 2011 Share Posted December 11, 2011 <?php echo nl2br($contribution_description); ?> nl2br is what you are looking for. Link to comment https://forums.phpfreaks.com/topic/252914-do-a-line-break-even-with-the-pre-tag/#findComment-1296657 Share on other sites More sharing options...
Glese Posted December 11, 2011 Author Share Posted December 11, 2011 It was actually meant for very long & continuous words. Those do not contain a new line as far as I know. Link to comment https://forums.phpfreaks.com/topic/252914-do-a-line-break-even-with-the-pre-tag/#findComment-1296662 Share on other sites More sharing options...
premiso Posted December 11, 2011 Share Posted December 11, 2011 Oh gotcha, check out wordwrap. Link to comment https://forums.phpfreaks.com/topic/252914-do-a-line-break-even-with-the-pre-tag/#findComment-1296663 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.