textarea post fetch problem

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
itsmani1
Forum Regular
Posts: 791
Joined: Mon Sep 29, 2003 2:26 am
Location: Islamabad Pakistan
Contact:

textarea post fetch problem

Post by itsmani1 »

Problem in fetching data from text area....
When i enter some text in textarea like:

Hi
this is text message
thanks

but i try to fetch it using post method i get this text in one line.. how can i fix it it?

ere is my code
thank you

Code: Select all

 
if(isset($_POST["submit"]))
{
echo $_POST["shortDesc"];
exit;
}
 
 

Code: Select all

 
<textarea name="shortDesc" cols="60" rows="4" id="shortDesc"></textarea>
<br/>
<input name="submit" type="submit" id="submit" value="  Submit  " />
 
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: textarea post fetch problem

Post by requinix »

It isn't on one line - it just looks that way because of how HTML works.

nl2br will make it look the way you expect.
Post Reply