MidOhioIT Posted January 24, 2010 Share Posted January 24, 2010 I have a form that is being used for the start of a newsletter for my client to fill in. The form has a textbox that is being used for the subject and a textarea that I am using for the body of the email. The problem that I am having is when you type in the textarea and you hit enter to start a new paragraph, the code just reads everything in the textarea and does not start the new line like it appears it does in the textarea. Is there an easy way to read the variable and capture the fact that the enter button was hit to do a "<br>" for a new line? Link to comment https://forums.phpfreaks.com/topic/189580-php-new-line-from-the-enter-button-pressed/ Share on other sites More sharing options...
teamatomic Posted January 24, 2010 Share Posted January 24, 2010 This is what you want, its what I use on my forms. http://www.dynamicdrive.com/dynamicindex16/disableenter.htm HTH Teamatomic Link to comment https://forums.phpfreaks.com/topic/189580-php-new-line-from-the-enter-button-pressed/#findComment-1000674 Share on other sites More sharing options...
MidOhioIT Posted January 24, 2010 Author Share Posted January 24, 2010 Thanks, but not exactly what I was saying. Let me try to explain differently. On the text area when I type the following: this is my first paragraph... This is my second paragraph... This is my thrid paragraph... I get this result in my email: this is my first paragraph... This is my second paragraph... This is my thrid paragraph... When I expect line breaks.. Link to comment https://forums.phpfreaks.com/topic/189580-php-new-line-from-the-enter-button-pressed/#findComment-1000781 Share on other sites More sharing options...
MidOhioIT Posted January 24, 2010 Author Share Posted January 24, 2010 i figured it out.. you have to do the following function: $content=nl2br($_POST['content']); Link to comment https://forums.phpfreaks.com/topic/189580-php-new-line-from-the-enter-button-pressed/#findComment-1000787 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.