Jump to content

Empty Spaces appear in Textarea


eadc

Recommended Posts

Everytime I retrieve text from database into this Textarea, it creates empty spaces before and after the text. When I fill in the text in the textarea I make sure it has no spaces, but still when I retrieve it back into the textarea it show spaces.

Database is very simple:

num, Smallint(1)

mytext, Text

 

Code to retrieve data:

<textarea name="mytext" cols="75" rows="15" class="FormFieldText" style="border:1 solid #999999">

      <?PHP

  if ($row[0] =='') //test for empty fields

        {echo "Sorry, Thought of the Week not defined yet!";}

            else

        {echo $row[0];}

?>

</textarea>

 

Thanks for your help.

 

Link to comment
https://forums.phpfreaks.com/topic/46022-empty-spaces-appear-in-textarea/
Share on other sites

textarea will display the spaces before and after the <?php  ?> tags.

<textarea name="mytext" cols="75" rows="15" class="FormFieldText" style="border:1 solid #999999"><?php
           if ($row[0] =='') //test for empty fields
           {echo "Sorry, Thought of the Week not defined yet!";}
            else
           {echo $row[0];}
?></textarea>

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.