Jump to content

[SOLVED] textarea display problem


NerdConcepts

Recommended Posts

I've tried a few things that I found on the forum but nothing seems to work. What I have is submitted information from a textarea. This submitted information is..for example

 

This is my multiple line description

another part of the description is down here...

 

well when I echo the value of what is stored in that textarea that was submitted to the database, is shows up like

 

This is my multiple line descriptionanother part of the description is down here...

 

Not really sure why, if I use phpMyAdmin to view the database it stores it with multiple lines...not sure at all on how to do this one. Plus it's now 5am so It's time I go to sleep maybe...or at least try, lol

Link to comment
https://forums.phpfreaks.com/topic/42206-solved-textarea-display-problem/
Share on other sites

Well it's a little different then I thought, but it does work. When you use

 

echo nl2br(htmlspecialchars($row['vendor_desc']));

 

for the actual echo location, well it doesn't parse the <br /> so you actually have to go back up near the query for the rows and define a variable...like this

 

$vdesc = $row['vendor_desc']));

 

then you have to then apply the nl2br.

 

$vdesc=nl2br(htmlspecialchars($vdesc));

 

then when you echo $vdesc it displays everything correctly. Showing this stuff just in case someone else has this problem later. Thank a lot for the help.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.