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? Quote 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. Quote 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. Quote 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. Quote 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
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.