Forum Moderators: coopster

Message Too Old, No Replies

Using MediumText

How to store carriage returns without <br>

         

inveni0

7:33 pm on Jan 3, 2006 (gmt 0)

10+ Year Member



How can I filter my input text for a Medium or Long text row in a table so that I don't have to use <br> for carriage returns?

chriswragg

7:43 pm on Jan 3, 2006 (gmt 0)

10+ Year Member



Have a look at the wordwrap [uk2.php.net] function. Not sure if its quite what you are looking for.

inveni0

8:04 pm on Jan 3, 2006 (gmt 0)

10+ Year Member



No, I'm looking for:

See how this line is below the above line? It's because I hit enter twice.

In my web application, these carraige returns are visible in the text area, but as soon as you insert the record, they are removed and everything exists on just one line (word wrapping to fit the table they're displayed in).

However, entering <br> instead of just hitting enter translates the carriage return and displays it correctly. But I don't want the user to have to enter <br> for every line break.

inveni0

8:25 pm on Jan 3, 2006 (gmt 0)

10+ Year Member



Never mind. I simply used this handy line in the editFormAction section:

$Text = nl2br($Text);

Then, in my insertSQL section I changed:

GetSQLValueString($_POST['Text'], "text"),

to:

GetSQLValueString($Text, "text"),

Now I just need to know how to strip the <br> tags out when editing the record.

inveni0

8:46 pm on Jan 3, 2006 (gmt 0)

10+ Year Member



I got this, too. I used the code:

<textarea name="Text" cols="100" rows="10" id="Text"><?php echo strip_tags($row_Edit['Text'], '<br />');?></textarea>