Announcement

Collapse
No announcement yet.

Help with some PHP, MySQL, and HTML

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Help with some PHP, MySQL, and HTML

    Ok, I am having some trouble here. I am making a simple script which will load contents out of a table into a text box, so I can edit it, and then modify it. (I am using this to manage the content of my pages). But, because the page i am loading out of the table has a closing </textarea> in it, it closes the text box, and then everything's all messed up.

    Like here: http://rgnetwork.com/helping.html

    What can I do to fix this?

  • #2
    well, you could always do an eregi_replace() on all < and > tags to these html codes for them : &lt; for < and &gt; for >

    Comment


    • #3
      say the $text variable contains the text to be displayed in the textarea:

      PHP Code:
      $text htmlspecialchars($text);
      print(
      "<textarea>$text</textarea>"); 

      Comment


      • #4
        Isn't it a browser interpretation problem anyway?

        Comment


        • #5
          it's not a problem. You just have to make sure the textarea content doesn't conflict with the html code. htmlspecialchars converts some chars to html-entities (like the ", ', <, > etc..) so the html won't be broken.

          Comment


          • #6
            Yes, but when displayed in a textbox, they won't be interpreted as html. They will remain as character codes.

            Comment


            • #7
              nope....when the text for instance is like this:

              $text = "blabla </textarea> blabla";

              and you wanna display it inside of a textarea, the textarea will be broken, because the html ends up like this:

              <textarea>blabla </textarea> blabla</textarea>

              When you use html_specialchars first, it will be like this:

              <textarea>blabla &lt;/textarea&gt; blabla</textarea>

              and it will display correctly

              Comment


              • #8
                Thanks Mas*Mind it worked!!! Now I have that all done, thanks a lot!!
                Last edited by Sean; Wed 13 Jun '01, 4:55pm.

                Comment

                widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
                Working...
                X