str_replace

Discussion in 'PHP' started by baris22, Jan 20, 2009.

  1. #1
    this is th code:

    
    <td><textarea name="fullpage[]" cols="140" rows="16" id="fullpage"><?=stripslashes ($rows['fullpage']) ?></textarea></td>
    
    PHP:
    
    <?phpif($Submit){
    for($i=0;$i<$count;$i++){
    $sql1="UPDATE $tbl_name SET title='$title[$i]', fullpage='$fullpage[$i]' WHERE id='$id[$i]'";
    $result1=mysql_query($sql1);
    }
    }
    if($result1){
    echo "<meta http-equiv=\"refresh\" content=\"0\">";
    }
    mysql_close();?>
    
    PHP:
    all i want to do is use str_replace to replace "</td>" with " </td>" on fullpage='$fullpage[$i]'

    Thanks for help.
     
    baris22, Jan 20, 2009 IP
  2. osmasters

    osmasters Well-Known Member

    Messages:
    453
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    100
    #2
    it seems that both are same only.
    I am not getting what do you want to change?
     
    osmasters, Jan 20, 2009 IP
  3. baris22

    baris22 Active Member

    Messages:
    543
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    60
    #3
    i want to replace "</td>" with " </td>" (there is space before the second </td>)
     
    baris22, Jan 20, 2009 IP
  4. osmasters

    osmasters Well-Known Member

    Messages:
    453
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    100
    #4
    try with all below options. I may hit correctly.
    $fullpage[$i] = str_replace("<//td>"," <//td>",$fullpage[$i]);

    $fullpage[$i] = str_replace("</td>"," </td>",$fullpage[$i]);

    $fullpage[$i] = str_replace("&lt;/td&gt;"," &lt;/td&gt:",$fullpage[$i]);

    $fullpage[$i] = str_replace("&lt;//td&gt;"," &lt;//td&gt:",$fullpage[$i]);
     
    osmasters, Jan 20, 2009 IP