doubledee Posted August 20, 2011 Share Posted August 20, 2011 I want a Text Area on my form where I can enter the body of an article. It should be sticky so the input is not lost if there are form issues and the form has to be re-loaded. The problem is that when I type "mmm" into this field, after I click "Submit" my form is reloaded - because I didn't complete it - and several blank lines appear before and after the text "mmm"?! Here is my code... <!-- Body --> <li> <label for="body"><span class="required">*</span>Body:</label> <textarea id="body" name="body" class="text" cols="20" rows="5" wrap="soft"> <?php if(isset($body)){echo htmlentities($body, ENT_QUOTES);} ?> </textarea> <?php if (!empty($errors['body'])){ echo '<span class="error">' . $errors['body'] . '</span>'; } ?> </li> What seems to be the problem?! Debbie Quote Link to comment https://forums.phpfreaks.com/topic/245312-problem-with-sticky-text-area/ Share on other sites More sharing options...
PFMaBiSmAd Posted August 20, 2011 Share Posted August 20, 2011 Every character that you output to the browser that is after the closing > of the <textarea> tag and before the opening < of the </textarea> tag becomes part of the data in the text area. Remove all the characters except what your php code is outputting - <textarea id="body" name="body" class="text" cols="20" rows="5" wrap="soft"><?php your php code ?></textarea> Quote Link to comment https://forums.phpfreaks.com/topic/245312-problem-with-sticky-text-area/#findComment-1259944 Share on other sites More sharing options...
doubledee Posted August 20, 2011 Author Share Posted August 20, 2011 Every character that you output to the browser that is after the closing > of the <textarea> tag and before the opening < of the </textarea> tag becomes part of the data in the text area. Remove all the characters except what your php code is outputting - <textarea id="body" name="body" class="text" cols="20" rows="5" wrap="soft"><?php your php code ?></textarea> Tada! Thanks!! Debbie Quote Link to comment https://forums.phpfreaks.com/topic/245312-problem-with-sticky-text-area/#findComment-1259946 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.