473,382 Members | 1,180 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

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:mail.google.commailhelpimageslogo.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!!

Feb 23 '06 #1
4 27161
coder wrote:
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:mail.google.commailhelpimageslogo.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!!


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_escape_string.

http://php.net/stripslashes
http://php.net/mysql_real_escape_string

--
Kim André Akerĝ
- ki******@NOSPAMbetadome.com
(remove NOSPAM to contact me directly)
Feb 23 '06 #2
coder wrote:
<img height=\"59\" alt=\"Gmail\"
src=\"https:mail.google.commailhelpimageslogo.gif\ " width=\"143\"
align=\"left\" vspace=\"10\" border=\"0\" >


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

Feb 23 '06 #3
Kim,

PERFECT!

A million thank you's! :-)

Feb 23 '06 #4
BTW- I am already using the mysql_real_escape_string function on my
transaction. The stripslashes function is exactly what I was looking
for.

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

Feb 23 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Aloysio Figueiredo | last post by:
I need to replace every ocurrence of '/' in s by '\/' in order to create a file named s. My first attempt was: s = '\/'.join(s.split('/')) but it doesn't work: >>> s = 'a/b' >>> s =...
3
by: Vincent Texier | last post by:
Hello, I want to send 3 chars in hexa code to the serial port. So I type in a tkinter entry : "\x20\x01\x21" The string is set in a StringVar(). When I read the stringVar, I get :...
4
by: Frank | last post by:
Hi, I'm not familiar with JavaScript but have to fix a problem. Please see below part of the HTML code with contains my question: The problem is that I have to display a path in the showIt...
10
by: Terry Olson | last post by:
I want to search a textbox and replace any instances of the dollar sign character. But when I do that it thinks it won't work because it think's I'm looking to replace something at the end of the...
14
by: Etu | last post by:
Hi, I have a string: string c = "'abc' \"cde\", 'mno' \"xyz\","; how can I use the c.Replace(???, ???) method to have this string: "'abc' "cde", 'mno' "xyz"," that is, all the...
4
by: jpierson | last post by:
Hi, I'm having a few problems with the replace function for replacing characters in a textbox. "C:\" is the string i am tryin to remove ,with it a command I am sending does not work. ...
6
by: John Salerno | last post by:
I have this: subdomain = raw_input('Enter subdomain name: ') path = r'C:\Documents and Settings\John Salerno\My Documents\My Webs\1and1\johnjsalerno.com\' + subdomain Obviously the single...
1
by: Kberg | last post by:
In case anyone is interested, this is how I solved the problem of replacing a back slash with a forward slash (as in being able to access a document on a file share on an intranet via a browser) ...
23
by: dkirkdrei | last post by:
I am having a bit of trouble trying to double up on slashes in a file path. What I am trying to do is very similar to the code below: <? $var =...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.