0

I have some data in database and want allow user to edit a field like description of product and sometimes it might be long to I wanna put already existing value into textarea so the user will already have old description in textarea and just add or delete some text. The problem is that I have some additional whitespaces at beginning and end of textarea even though there is no whitespace in this text I even echo that variable to make sure there is no space. I even trim my variable to remove it but it doesn't change anything.

It looks like that: https://i.stack.imgur.com/8TVXR.png

I want to get rid of these whitespaces

Html code:

<textarea cols="50" rows="5" name="text">
                            <?php 
                            $info = trim($row['description']);
                            echo $info;?>
                            </textarea>

Php code:

$sql = "SELECT * FROM shops WHERE id_shop = '$id_shop'";
$result = mysqli_query($conn, $sql);
$row = mysqli_fetch_array($result);
Czesi Joum
  • 63
  • 6

2 Answers2

1

Simply remove all extra whitespace before during and after the php.

<textarea cols="50" rows="5" name="text"><?php $info = trim($row['description']);echo $info;?></textarea>
gavgrif
  • 15,194
  • 2
  • 25
  • 27
0

there is lots of spaces before

                        <?php 

e.q. many spaces then < ? php ...