Jump to content

Problem with Sticky Text Area


doubledee

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

 

 

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.