I have a problem with my script i am trying to format a text area so that on the next page it displays it as it was entered in the textarea.

my css style says this

textarea {
width:450px;
padding:2px;
font: normal 1em Verdana, sans-serif;
border:1px solid #eee;
height:100px;
display:block;
color:#777;

then it is a simple htmll textarea on a php page.

<tr>
<td class="mytransr" id="t_mess">
Message To Client</td>
</tr>
<tr>
<td class="mytransr">
<textarea name="message"></textarea>


<br /></td>


</tr>

the next pae starts and has the line

$message        =   stripslashes($_POST["message"]);

and down the page i have <td><?=$message?>

the problem is in the text area i put

hello how are you?
where are you?
are you there?

on the second page where it displays message it comes out as

hello how are you? where are you? are you there?

how can i make this come out in the same format as it was entered in the initial textarea???

I have been at this 4 hour and hours can anyone ive me a hint please.

thanks

Edited 3 Years Ago by pyTony: fixed formatting

Try this:

$message = stripslashes(nl2br($_POST["message"]));

nl2br is a PHP function to replace new lines with <BR> tags

Sorry again I don't supppose there is a way to make urls display as hyperlinks that are sent in a textarea?

i.e www.google.com so it comes out as a hyperlink?

This article has been dead for over six months. Start a new discussion instead.