7 Replies - 587 Views - Last Post: 24 March 2009 - 08:24 PM Rate Topic: -----

#1 oliabak  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 4
  • Joined: 24-March 09

a problem with line break ... I need help !

Posted 24 March 2009 - 05:44 PM

hi every one

i have a problem with line break .

i created a textarea & when i press enter ...
in the database it dont creat a line break.

for example :

if i write :
hi
how are you

it will show me >> hi how are you

so i have to write it like that:

hi<br/>how are you

isn't there any whay to solve this problem
Is This A Good Question/Topic? 0
  • +

Replies To: a problem with line break ... I need help !

#2 atik97  Icon User is offline

  • ???
  • member icon

Reputation: 144
  • View blog
  • Posts: 715
  • Joined: 16-September 08

Re: a problem with line break ... I need help !

Posted 24 March 2009 - 06:00 PM

You need to use \n instead of <br/>.
Was This Post Helpful? 0
  • +
  • -

#3 oliabak  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 4
  • Joined: 24-March 09

Re: a problem with line break ... I need help !

Posted 24 March 2009 - 06:45 PM

i mean i want to press "enter" & have a line.
but when i press "enter" ...
and when it add to the database it will be as a "space".
im writing in the text are ...
i want it like this text area in the forom ...
you dont write <br/> or \n here
but it change to ... <br/>
i hope you got what i mean
(sudly im not good in english so i hope i got what i mean)

This post has been edited by oliabak: 24 March 2009 - 06:53 PM

Was This Post Helpful? 0
  • +
  • -

#4 atik97  Icon User is offline

  • ???
  • member icon

Reputation: 144
  • View blog
  • Posts: 715
  • Joined: 16-September 08

Re: a problem with line break ... I need help !

Posted 24 March 2009 - 06:57 PM

If you show your code then you will get a good response.
Was This Post Helpful? 0
  • +
  • -

#5 oliabak  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 4
  • Joined: 24-March 09

Re: a problem with line break ... I need help !

Posted 24 March 2009 - 07:40 PM

<tr bgcolor="#00FF33">
<th>detail</th>
<th>
<textarea name="detail" cols="30" rows="10"></textarea>
</th>
</tr>



this is for adding

i write in the textarea like that :

hi
i need some help
there is no lines



when i call it :

<?php
while($row=mysql_fetch_array($_SESSION['selSQL'])){//start while
?>
<tr><td>
<?php echo $row['detail'] ?>
</td></tr>



it will write for me this :

hi i need some help there is no lines



for having lines i have to write like that in the textarea

hi<br/>i need some help <br/> there is no lines


Was This Post Helpful? 0
  • +
  • -

#6 Valek  Icon User is offline

  • The Real Skynet
  • member icon

Reputation: 542
  • View blog
  • Posts: 1,713
  • Joined: 08-November 08

Re: a problem with line break ... I need help !

Posted 24 March 2009 - 07:45 PM

When you pull it from the database, you can simply do this:

$detail = nl2br($row['detail']);
echo $detail;


That'll change your line breaks into HTML line breaks for display on the page. That way, you don't have to type the break tags when you type into the text area. If you want, you can even run nl2br() on the input when it's stored, and just bring it out of the database as you are now. Either one works. Regular line breaks only show up in <pre></pre> tags, in files, and inside textareas. Otherwise, you have to use <br />.

This post has been edited by Valek: 24 March 2009 - 07:46 PM

Was This Post Helpful? 0
  • +
  • -

#7 oliabak  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 4
  • Joined: 24-March 09

Re: a problem with line break ... I need help !

Posted 24 March 2009 - 08:23 PM

ya its work ....
thanks
Was This Post Helpful? 0
  • +
  • -

#8 Valek  Icon User is offline

  • The Real Skynet
  • member icon

Reputation: 542
  • View blog
  • Posts: 1,713
  • Joined: 08-November 08

Re: a problem with line break ... I need help !

Posted 24 March 2009 - 08:24 PM

You're welcome :)
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1