Jump to content

[SOLVED] Losing html code when editing


Dimwhit

Recommended Posts

I've been looking all over for this, so I thought I'd register here and give it a shot.

 

I've set up some pages that allow me to post what amount to articles through a backend form. In this form, I'm directly pasting the article contents, along with the html code that goes with it. It displays just fine, but when I go back to edit it, when the contents of that field are displayed in the textarea, the top part of it is lost. It varies...sometimes just the opening <p> tag, other times a whole paragraph up to and including the next <p> tag. So it looks like when the field contents are being brought into the form textarea, everything up to and including the first paragraph tag is stripped. And at the same time, that paragraph tag (with the style info) is read by my browser so that all the text in the field displays with whatever style was attached to that tag.

 

Does that make any sense? How can I force ALL the field content to appear for edit, including the opening html tags?

 

Thanks! Looks like there's a lot of info floating around here. I'll be diving in soon, I think. :)

Link to comment
Share on other sites

I'm not sure there's much to show. I used a standard form to input a body of text into the field $body. In order to edit that content, I have a script that will update the $body field with the new info I use the following:

 

<textarea name="ud_body" cols="80" rows="80" id="body" value="<? echo $body; ?>">

 

In the update form. It retrieves all content from $body, I edit it, then the script I use takes the new content, now from ud_body, and inserts it back in the $body field.

 

The problem is that when the content date as retrieved using the value="<? echo $body; ?>" call in the form, some of the content (the html tags) is being stripped out of it. For example, the first line of text that I inserted into $body the first time was:

 

<p align="left" class="standardtextitalics">We have learned an important

              principle since the inception...</p>

 

However, what shows up when I go to edit it is:

 

We have learned an important

              principle since the inception...</p>

 

Does that make any more sense?

Link to comment
Share on other sites

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.