ianhaney Posted November 17, 2015 Share Posted November 17, 2015 HiEach time I go to insert or edit a textarea, I seem to have big blank space before typing so can't start typing from the left and always seems to start way over to the left on the first line and I keep having to delete the blank spaces so is over to the left before I can start typing, the coding I have is below <strong>Comments:</strong> <br> <textarea name="comments"> <?php echo $comments; ?> </textarea> Just seeing if anyone can see if I have done anything wrong somewhere? Thank you in advance Ian Quote Link to comment Share on other sites More sharing options...
Solution Barand Posted November 17, 2015 Solution Share Posted November 17, 2015 Everything between the textarea tags is part of the value, including all the whitespace in your source. Use <textarea name="comments"><?php echo $comments; ?></textarea> Quote Link to comment Share on other sites More sharing options...
Ch0cu3r Posted November 17, 2015 Share Posted November 17, 2015 (edited) With the textareas whatever is between the opening and closing tags is treated as the value. This is why you are having lots of whitespace before (and after) the php value that is being outputted. I would suggest to remove the whitespace/code indentation inside the textarea tags, with addition of applying trim to $comments. <strong>Comments:</strong> <br> <textarea name="comments"><?php echo trim($comments); ?></textarea> Edited November 17, 2015 by Ch0cu3r Quote Link to comment Share on other sites More sharing options...
ianhaney Posted November 17, 2015 Author Share Posted November 17, 2015 Hi Barand and Ch0cu3r I have altered the coding to what you both said and is perfect now, thank you so much Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.