Jump to content

Recommended Posts

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"?!  :shrug:

 

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

 

 

Link to comment
https://forums.phpfreaks.com/topic/245312-problem-with-sticky-text-area/
Share on other sites

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>

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

 

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.