View Full Version : Strip Slashes?

02-10-2003, 02:47 AM

I'm using a HTML template that combines some ASP include tags to pull in specific content. When this content is captured from a form and stored in variables it includes 'slashes' before ( " ) and ( ' ) are used.

I know there is a stripslash() function in PHP but I have little experience with ASP. Can anyone enlighten me on how to format the following tags within HTML to omit these slashes when encountered:

<span class="TextBlackBold18">NED E-Card from
<img src="<%ecard_image_name%>" border="1">
<p class="TextBlackBold12">


02-10-2003, 04:38 AM
is this what you mean?


don't forget the equal sign.

02-10-2003, 05:06 AM
No, that didn't seem to work. The message string displays nothing at all.

I'm using a pre-written script found at:

There are various include files that deal for formatting, particularly the use of preg_replace PHP function:

function parse_ecard_template($ecard,$ecard_data) {
$ecard_data = preg_replace ("/<%ecard_sender_email%>/",
$ecard["email_sender"], $ecard_data);
$ecard_data = preg_replace ("/<%ecard_sender_name%>/",
$ecard["name_sender"], $ecard_data);
$ecard_data = preg_replace ("/<%ecard_image_name%>/", $ecard["image_name"],
$ecard_data = preg_replace ("/<%ecard_message%>/", preg_replace ("/\r?\n/",
"<BR>\n", htmlspecialchars($ecard["message"])), $ecard_data);
$ecard_data = preg_replace ("/<%ecard_reciepient_email%>/",
$ecard["email_recepient"], $ecard_data);
$ecard_data = preg_replace ("/<%ecard_reciepient_name%>/",
$ecard["name_recepient"], $ecard_data);
return $ecard_data;

Could your previous solution be used in this somehow?

Many thanks!

02-10-2003, 08:51 AM
Like Glenn was saying (kinda) you can use the Replace() function of ASP to replace slashes.

I'm confused about the mixing of PHP and ASP here though. Are you using both or did you mean that as an example?

Anyhow back to what I was saying, to use the Replace() function just have it like below, subsitute Variable for the variable name.

Variable=Replace(Variable, "/", "")

That will clear any slashes contained in the variable.

I hope this is what you mean.

02-10-2003, 07:24 PM
I'm confused about the mixing of PHP and ASP here though. Are you using both or did you mean that as an example?

Your right... I was confused as well. I'm hoping someone can shed some light on the way this script is structured.

The 'Replace()' function doesn't work. The variable will return nothing if this function is in place as such:


Anyone with an idea on how to strip the slashes created by ( ' ) and ( " ) characters in a variable? Anyone...

02-11-2003, 01:38 AM
ASP doesn't create or use "slashes" to comment double/single quotes out like a C-type syntax language would...

extra double quotes are commented in ASP/VBScript by another... like:

Response.Write("<a href=""somepage.asp"">somepage</a>")

So I'm really confused as to what's going on here. :)

02-11-2003, 03:55 AM
Yeah, I think I've confused a lot of people, including myself.

I'm going to move this to the PHP forum and see if its better off there!