SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Member
    Join Date
    Oct 2009
    Posts
    8
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Post fckeditor probelm to remove space between twolines

    hi..i am new to the editor concepts.i used fckeditor to change the fonts for php.i used php object to implement it with the textarea i am able to do that.but when i enter the data to the database in a paragraph its working fine.but if i enter suppose

    line1
    line2
    line3.. its taking the space. so what i did while entering the data only i tried to remove the space using the trim () and addslases().i tried all the possiblites. and then to find the stringlength but still its taking the same with counting the space..

    i want my data to appear as :line1line2line3.. because later i need to find the substr() upon the inserted data so..please anyone help me.. here is my code:

    <?php
    include_once("fckeditor/fckeditor.php") ;
    include("connection.php");
    if(isset($_POST['Submit']))
    {
    $title=$_POST['title'];
    $des1=$_POST['descr'];
    /*$des=addcslashes($des1);*/
    $des=addcslashes($_POST['descr'],"\x00..\x1f\x22\x27\x5c");
    echo $q="insert into xyz(descr)values('$des')";
    echo $r=mysql_query($q);
    }

    ?>


    this is fck code:

    <?php
    $oFCKeditor=new FCKeditor('descr') ;
    $oFCKeditor->BasePath='../fckeditor/';

    echo $oFCKeditor->Value=addslashes(html_entity_decode($oFCKeditor->descr));

    $oFCKeditor->Width = '700px' ;
    $oFCKeditor->Height = '350px' ;

    $oFCKeditor->Create() ;
    ?>



    please give ur suggestion.. hw can i do that.

    regards

  2. #2
    Follow Me On Twitter: @djg gold trophysilver trophybronze trophy Dan Grossman's Avatar
    Join Date
    Aug 2000
    Location
    Philadephia, PA
    Posts
    20,578
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    This has nothing to do with escaping quotes, so addslashes isn't the answer

    You want to remove line breaks, so replace them with nothing

    PHP Code:
    $des str_replace("\n"""$_POST['descr']);
    $des str_replace("\r"""$des); 

  3. #3
    SitePoint Member
    Join Date
    Oct 2009
    Posts
    8
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thanks for your reply.. i tried with that option also..but still it is taking the newline.is there any function i can use....i tried with trim().its workng fine with the other fields w/o the editor.but when i enter it with in the editor..its not happeng..


Bookmarks

Posting Permissions

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