How to Replace Backslash ( \ )?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • coder

    How to Replace Backslash ( \ )?

    Hello,

    I have a content management page where I can place rich text.

    On the confirmation page I display the rich text the user has inputted.
    However, I am noticing that when images are included in the rich text,
    the confirmation page is not displaying it. When looking at the source
    code, it is outputting:

    <img height=\"59\" alt=\"Gmail\"
    src=\"https:mai l.google.commai lhelpimageslogo .gif\" width=\"143\"
    align=\"left\" vspace=\"10\" border=\"0\" >

    Now, when I submit this the image does get inserted into the database
    properly. However, on the confirmation page is does not. Is there a
    replace function to use for "\" to only display the rich text on the
    confirmation page?

    I would use a separate variable to retain the above formatting so that
    MySQL doesn't throw an error.

    Any assistance would be much appreciated!!

  • Kim André Akerø

    #2
    Re: How to Replace Backslash ( \ )?

    coder wrote:
    [color=blue]
    > Hello,
    >
    > I have a content management page where I can place rich text.
    >
    > On the confirmation page I display the rich text the user has
    > inputted. However, I am noticing that when images are included in
    > the rich text, the confirmation page is not displaying it. When
    > looking at the source code, it is outputting:
    >
    > <img height=\"59\" alt=\"Gmail\"
    > src=\"https:mai l.google.commai lhelpimageslogo .gif\" width=\"143\"
    > align=\"left\" vspace=\"10\" border=\"0\" >
    >
    > Now, when I submit this the image does get inserted into the database
    > properly. However, on the confirmation page is does not. Is there a
    > replace function to use for "\" to only display the rich text on the
    > confirmation page?
    >
    > I would use a separate variable to retain the above formatting so that
    > MySQL doesn't throw an error.
    >
    > Any assistance would be much appreciated!![/color]

    If you're outputting this to the browser, stripslashes() would be in
    place. If you're inserting this code into a MySQL table, look into
    mysql_real_esca pe_string.

    PHP is a popular general-purpose scripting language that powers everything from your blog to the most popular websites in the world.

    PHP is a popular general-purpose scripting language that powers everything from your blog to the most popular websites in the world.


    --
    Kim André Akerø
    - kimandre@NOSPAM betadome.com
    (remove NOSPAM to contact me directly)

    Comment

    • Sjoerd

      #3
      Re: How to Replace Backslash ( \ )?

      coder wrote:[color=blue]
      > <img height=\"59\" alt=\"Gmail\"
      > src=\"https:mai l.google.commai lhelpimageslogo .gif\" width=\"143\"
      > align=\"left\" vspace=\"10\" border=\"0\" >[/color]

      The addition of these backslashes is known as "magic quotes". You can
      disable it in the config file.

      Comment

      • coder

        #4
        Re: How to Replace Backslash ( \ )?

        Kim,

        PERFECT!

        A million thank you's! :-)

        Comment

        • coder

          #5
          Re: How to Replace Backslash ( \ )?

          BTW- I am already using the mysql_real_esca pe_string function on my
          transaction. The stripslashes function is exactly what I was looking
          for.

          Once again... THANK YOU !! :-)

          Comment

          Working...