Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7

Thread: Strip Slashes?

  1. #1
    New to the CF scene
    Join Date
    Feb 2003
    Location
    Sydney, Australia
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Strip Slashes?

    Hi,

    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
    <%ecard_sender_name%>
    </span><br>
    <br>
    <img src="<%ecard_image_name%>" border="1">
    <p class="TextBlackBold12">
    <%ecard_message%>
    </p>

    Thanks!

  • #2
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,068
    Thanks
    0
    Thanked 256 Times in 252 Posts
    is this what you mean?

    <%=replace(ecard_sender_name,"/","")%>

    don't forget the equal sign.
    Glenn
    ____________________________________

    My Blog
    Tower of Hanoi Android app (FREE!)
    Tower of Hanoi Leaderboard
    Samegame Facebook App
    vBulletin Plugins
    ____________________________________

  • #3
    New to the CF scene
    Join Date
    Feb 2003
    Location
    Sydney, Australia
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts
    No, that didn't seem to work. The message string displays nothing at all.

    I'm using a pre-written script found at:
    http://www.ibps-friedrichs.de/_downl...cards_1-01.zip

    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);
    $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!

  • #4
    Senior Coder Mhtml's Avatar
    Join Date
    Jun 2002
    Location
    Sydney, Australia
    Posts
    3,531
    Thanks
    0
    Thanked 1 Time in 1 Post
    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.
    Code:
    Variable=Replace(Variable, "/", "")
    That will clear any slashes contained in the variable.

    I hope this is what you mean.
    Omnis mico antequam dominus Spookster!

  • #5
    New to the CF scene
    Join Date
    Feb 2003
    Location
    Sydney, Australia
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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:

    <%ecard_message=replace(ecard_message,"/","")%>

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

  • #6
    Senior Coder
    Join Date
    Jun 2002
    Location
    41° 8' 52" N -95° 53' 31" W
    Posts
    3,660
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.
    Former ASP Forum Moderator - I'm back!

    If you can teach yourself how to learn, you can learn anything. ;)

  • #7
    New to the CF scene
    Join Date
    Feb 2003
    Location
    Sydney, Australia
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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!


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •