drewrockshard
drewrockshard

Reputation: 2071

Leading spaces in textarea from MySQL

I'm retrieving data from a mysql table column and placing it into a textarea.

When I do this, I get a huge section of leading spaces for only the first row of data. I've tried using mysql TRIM and PHP TRIM functions, and neither of them seem to work. Additionally, when I query the database directly, there are no leading spaces:

+-----------------+
| article_content |
+-----------------+
| # Test
        |
+-----------------+

Has anyone had this issue before?

enter image description here

Upvotes: 0

Views: 488

Answers (1)

drewrockshard
drewrockshard

Reputation: 2071

This happens more often than not, but I try for several hours to fix something and can't figure it out, and then I post here on stack overflow, and then the answer hits me.

The issue was with my HTML section. I forgot that textarea will interpret all spaces and tabs, etc, so when I indented my code that is inside some PHP code, it interpreted it, and inserted the spaces/tabs.

Upvotes: 3

Related Questions