Jump to content

Need Help Urgent !!!

- - - - -

  • Please log in to reply
5 replies to this topic

#1
dragonzone

dragonzone

    Newbie

  • Members
  • Pip
  • 3 posts
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...

#2
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
  • Location:Upstate, South Carolina
  • Programming Language:C, C++, PL/SQL, Delphi/Object Pascal, Pascal, Transact-SQL, Others
  • Learning:Java, C#, PHP, JavaScript, Lisp, Fortran, Haskell, Others
PHP: str_replace - Manual

You'll search for chr(13)&chr(10)
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

#3
Alexander

Alexander

    It's Science!

  • Moderators
  • 4,124 posts
  • Location:Vancouver, Eh! Cleverness: 200
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.

#4
dragonzone

dragonzone

    Newbie

  • Members
  • Pip
  • 3 posts
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...

#5
Alexander

Alexander

    It's Science!

  • Moderators
  • 4,124 posts
  • Location:Vancouver, Eh! Cleverness: 200
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:
<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.

#6
dragonzone

dragonzone

    Newbie

  • Members
  • Pip
  • 3 posts
Thnx for helping sir...I understand and will try this..:)




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users