I have a simple php file that gets info from mysql database display inside textarea but when I open it from browsers it shows extra space at the beginning and end of the text inside textarea
this is how it looks (database text has no extra space)
this is what I did to retrieve the text
<textarea name="text" rows="9">
<?php echo $fetchedData['founder_msg']; ?>
</textarea>
I used simple mysql_fetch_array to retrieve the value text are saved inside founder_msg field in mysql database of data type text.
Just put your php open tag right after the textarea close tag.. Dont use line break.. And close php exactly before (as you have done).. This will erase all the whitespaces..
Just use non-breakable spaces: instead of regular spaces.
You're inserting a lot of white-space with your formatting. Try the following instead:
<textarea name="text" rows="9"><?php
echo trim( $fetchedData['founder_msg'] ); // trim, following comments
?></textarea>
Try it like this:
<textarea name="text" rows="9"><?=trim($fetchedData['founder_msg'])?></textarea>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With