473,738 Members | 3,636 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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!!

Feb 23 '06 #1
4 27186
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: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!!


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.

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

--
Kim André Akerø
- ki******@NOSPAM betadome.com
(remove NOSPAM to contact me directly)
Feb 23 '06 #2
coder wrote:
<img height=\"59\" alt=\"Gmail\"
src=\"https:mai l.google.commai lhelpimageslogo .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_esca pe_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
6910
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 = '\/'.join(s.split('/'))
3
15873
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 : "\\x20\\x01\\x21"
4
17287
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 function. If I write the path (C:\TEMP\396.x00) directly in the document.write() function is shows the path without the backslashed. So I though I create a fixPath function that replaces the single backslash to a forward backslash (better a forward...
10
12141
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 line. How do I tell it to look for literal dollar signs?
14
3274
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 backslashes are removed.
4
14530
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. txtS_Filename.Text.Replace("C:\", ""); The compiler has a problem with the newline slash character but even
6
3191
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 backslash at the end of 'path' will cause a problem, and escaping it with a backslash seems to fix this problem, but how does escaping work when I already have it as a raw string? When I
1
15182
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) if you cut and paste a path from windows explorer \\myshare\mydir\mydoc.txt into a form textbox, you can use the following code to transform it into something usable by a browser: mytxt = document.myForm.myTextBox.value; mytxt =...
23
13519
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 = "\\wusais\Intranets\Intranets\fpdb\pdf\weinig\00505882.pdf"; $new = preg_replace("\\", "\\\", "$var"); ?> Code above produces the following error:
0
8969
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8788
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9335
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8210
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6053
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4570
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4825
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2745
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2193
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.