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 2 of 2
  1. #1
    Regular Coder
    Join Date
    Jan 2007
    Posts
    217
    Thanks
    9
    Thanked 0 Times in 0 Posts

    Problem with breaking lines(nl2br)

    $comment = nl2br(checkinput($_POST['comment']));

    I use this to try and add in the breaklines that a user does without adding the <br> codes.

    But this just doesn't seem to be putting in the linebreaks :X

    My checkinput function does this:

    PHP Code:
    function checkinput($value) {
    $value mysql_real_escape_string($value);
    $value strip_tags($value);
    $value htmlentities($value);
    //Scan for bad words. GO GO GO


    //our smilie codes

    $smilie_codes "java, script, javascript";

    //our smilie images

    $smilie_images "-blocked-,-blocked-,-blocked-";

    //set our smilie codes into an array

    $smilies explode(", "$smilie_codes);

    //set our smilie images into an array

    $images explode(", "$smilie_images);

    $amount count($smilies)-1//we'll decrease it by 1, since all array's start with the number [0] and not [1], and counting of them DOES start by1, so if we want to know the last array number string, we gotta decrease it by 1

    for($i=0;$i<=$amount;$i++)
    {

          
    $value str_replace($smilies[$i],$images[$i], $value);

    }

    return 
    $value;

    any help?

  • #2
    New to the CF scene
    Join Date
    Jul 2008
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I think the problem you'r having is that you'r "scan for bad words" it's deleting all you'r html content, thats why nl2br doesn't work


  •  

    Posting Permissions

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