Hi Guyz how are you...
i am new in codecall..
I need help i have created a website on sms i want that user(s) post sms i have created a form in php for posting sms and connected the page to mysql database. Main problem i am facing is that in text area when i press enter then it display line change but when i submit sms and get output it display in paragraph
Example 1:
Suppose this is my text area
<textarea>
Content line 1......
Content line 2......
Content line 3......
</textarea>
in the above example void textarea tag okie.. now after submitting the lines entered in textarea it will display like this
Example 1 Output:
Content line 1......Content line 2......Content line 3......
i dont want it like this... :-(
Example 2:
now when we enter <br /> tag like this
Content line 1......<br />
Content line 2......<br />
Content line 3......<br />
then after submitting it will display like this
Example 2 Output:
Content line 1......
Content line 2......
Content line 3......
i need this result (Example 2 Output) but without entering br tag at the end of each line it is creating diffculties for my visiters..
This is the simplest code of textarea which i have used..
<textarea name="msg" cols="40" rows="10" id="msg"></textarea>
Please tell me the simple solution Thnx in Advance to all...
5 replies to this topic
#1
Posted 09 May 2011 - 12:32 PM
|
|
|
#2
Posted 09 May 2011 - 04:54 PM
#3
Posted 09 May 2011 - 06:22 PM
nl2br will actually take care of this for you, it is also in our frequently asked questions for this section http://forum.codecal...-questions.html (#4)
Be sure to read the updated FAQ! || Health is achieved through the same 10,000 steps.
If a suggested code/method fails, informing us is less important than telling us why or what errors occurred.
If a suggested code/method fails, informing us is less important than telling us why or what errors occurred.
#4
Posted 10 May 2011 - 10:52 AM
sir Alexander
Thanx for ans sir i need output like this without entering <br/> tag
Content line1......
Content line2......
but i think by using nl2br it will display like this
Content line1......<br />
Content line2......
if i m wrong then please would you like to tell me some clear example according to my need...
Thanx for ans sir i need output like this without entering <br/> tag
Content line1......
Content line2......
but i think by using nl2br it will display like this
Content line1......<br />
Content line2......
if i m wrong then please would you like to tell me some clear example according to my need...
#5
Posted 10 May 2011 - 11:09 AM
Your text message does contain newlines (and will display properly if you send it to a phone), but if you are displaying it on a web page you must use the nl2br function as HTML will remove newlines or extra whitespace.
You can technically display it with <pre> tags:
And you will notice the message will be properly formatted, this is because the preformatting tag respects the contained whitespace (it forces the text to become courier/monospace though, so that is not a real solution, only an example)
You can technically display it with <pre> tags:
<pre> <?php echo $_POST['msg']; ?> </pre>
And you will notice the message will be properly formatted, this is because the preformatting tag respects the contained whitespace (it forces the text to become courier/monospace though, so that is not a real solution, only an example)
Be sure to read the updated FAQ! || Health is achieved through the same 10,000 steps.
If a suggested code/method fails, informing us is less important than telling us why or what errors occurred.
If a suggested code/method fails, informing us is less important than telling us why or what errors occurred.
#6
Posted 12 May 2011 - 09:23 AM
Thnx for helping sir...I understand and will try this..:)
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users


Sign In
Create Account

Back to top









