473,395 Members | 1,692 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Textarea and Breakline

imarkdesigns
Hi,
just want to know how can i possibly do having a breakline while typing inside the textarea box.. um, just like doing in blog page... so you can put break lines or paragraph.? sorry i cant exactly figure out the problem, but i hope you got the idea in typing paragraph in textarea in a blog page. i guess this is some kind of a javascript language...
Oct 24 '07 #1
4 4069
MarkoKlacar
296 Expert 100+
Hi,

let me just make sure I got the problem right, you want to write something in a textbox and have the formatting, in this case breakline, correct?

Just like you assumed my guess is you need some javascript textbox that preserves formatting, don't think you can control this using php unfortunately.

Try posting in the javascript forum.

Cheers.
Oct 26 '07 #2
ak1dnar
1,584 Expert 1GB
once key in the ENTER key if you want to start with a new line you can use nl2br(). see the sample here. but I think you may better to use a advance editor.

Expand|Select|Wrap|Line Numbers
  1. <html>
  2. <head>
  3. </head>
  4.  
  5. <body>
  6. <form action="line_brakes_in_text_areas_.php" method="post">
  7. <textarea name="txt_nl2br" rows="" id="txt_nl2br"></textarea>
  8. <input name="nl2br" type="submit" id="nl2br" value="nl2br" />
  9. <br />
  10. <textarea name="txt_normal" rows="" id="txt_normal"></textarea>
  11. <input name="Normal" type="submit" id="Normal" value="Normal" />
  12. <br />
  13. </form>
  14. </body>
  15. </html>
Expand|Select|Wrap|Line Numbers
  1. <?php
  2. if(isset($_POST['nl2br'])){
  3. echo nl2br($_POST['txt_nl2br']);
  4. }
  5. if(isset($_POST['Normal'])){
  6. echo $_POST['txt_normal'];
  7. }
  8. ?>
  9.  
Oct 26 '07 #3
once key in the ENTER key if you want to start with a new line you can use nl2br(). see the sample here. but I think you may better to use a advance editor.

Expand|Select|Wrap|Line Numbers
  1. <html>
  2. <head>
  3. </head>
  4.  
  5. <body>
  6. <form action="line_brakes_in_text_areas_.php" method="post">
  7. <textarea name="txt_nl2br" rows="" id="txt_nl2br"></textarea>
  8. <input name="nl2br" type="submit" id="nl2br" value="nl2br" />
  9. <br />
  10. <textarea name="txt_normal" rows="" id="txt_normal"></textarea>
  11. <input name="Normal" type="submit" id="Normal" value="Normal" />
  12. <br />
  13. </form>
  14. </body>
  15. </html>
Expand|Select|Wrap|Line Numbers
  1. <?php
  2. if(isset($_POST['nl2br'])){
  3. echo nl2br($_POST['txt_nl2br']);
  4. }
  5. if(isset($_POST['Normal'])){
  6. echo $_POST['txt_normal'];
  7. }
  8. ?>
  9.  
interesting and it works perfectly...

thank you very much for your help! i appreciate it. :)
Oct 27 '07 #4
ak1dnar
1,584 Expert 1GB
interesting and it works perfectly...

thank you very much for your help! i appreciate it. :)
Welcome! and if you ever need anything post back to the forum. good luck.
Oct 27 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Csaba Gabor | last post by:
What I'd like to do is to be able to set the font of a textarea element to the same font that another element is using (say, for example, an <INPUT type=text ...> element, but if that's a no go,...
1
by: Volt | last post by:
is there any way to select and mark part of text in textarea by regular expression? i need to select the first string in textarea whitch is like xxxxx,xxx where x is any character
5
by: Jesper Rønn-Jensen | last post by:
I have a textarea that must be limited to 70 characters. No big deal -- at least so I thought. * Textarea must not exceed 70 characters * Exceeding content must be cut off * Must work on input by...
4
by: TJS | last post by:
can the rows and columns of a textarea element with an id be changed on the fly ? if so is there an example ?
6
by: wperry1 | last post by:
I am writing a small database utility to catalog all of my favorite ASM/JS/VBS... functions and scripts on an asp page. Everything is going smoothly except for one thing that I can't quite seem to...
6
by: Tony | last post by:
The w3schools HTML tag reference for <textarea> http://www.w3schools.com/tags/tag_textarea.asp says that the attributes 'cols' and 'rows' are REQUIRED attributes for the textarea tag. Looking at...
4
by: Keith Bentrup | last post by:
Hi all, I wrote a simple search function to find text in a textarea where not all the text is visible (ie. the text box displays 10 lines but there may be more than 1000 lines to search). I can...
3
by: MikeK | last post by:
Ok, I've been noodling with this for several days now and I'm starting to go crazy. Does Apple's Safari browser support drag events on Textarea elements? The few specs and docs I've found seem to...
3
by: FunkHouse9 | last post by:
I'm working on a form to collect data in a textarea which and am trying to keep returns and spaces. I have a couple of functions that I Frankensteined together to replace returns with <br> and to...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.