Grow your CSS skills. Land your dream job.

Replace PHP string

  • # February 23, 2012 at 2:15 pm

    So this is my code, it’s supposed to replace with

    
    

    as well as ending, and fix line break within a PHP form submit action.


    $questions = $_REQUEST;
    $comment2 = htmlentities($questions, ENT_QUOTES);
    $question3 = ereg_replace( "n", "
    ", $comment2);
    $question4 = ereg_replace( "<code>", "
    ", $question3);
    $question = ereg_replace( "</code>", "

    ", $question4);

    # February 25, 2012 at 11:20 am

    will replacing

    n

    with


    not add unwanted code to your element?
    I think you may need to escape the new characters, not sure though

    "
    "


    I don't have access to test now, so I'll get back to you

    # February 25, 2012 at 11:51 am

    That is true, any way I can *not escape in the pre* ?

    # February 25, 2012 at 1:00 pm

    Check this out:
    http://jsfiddle.net/T7jPC/

    The code and pre tags were messing with this comment box

    # February 25, 2012 at 2:09 pm

    @karlpcrowley – Thank’s :) – I saw another problem I fixed (and after that, it worked). When inserting info into my database, I have to use ', so when

    
    

    came, it messed up, so I just edited the pre to

    
    

    instead! :)
    Thank's for your wonderful help!

    # February 25, 2012 at 2:22 pm

    no problem, don’t know why I didn’t think of leaving the class unquoted

    # February 25, 2012 at 2:59 pm

    Some things just slip our minds sometimes, it’s funny how that works!

Viewing 7 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".