Нужен php скриптик!

Discussion in 'PHP' started by fly, 8 Aug 2008.

Thread Status:
Not open for further replies.
  1. fly

    fly Member

    Joined:
    15 Apr 2007
    Messages:
    584
    Likes Received:
    95
    Reputations:
    -10
    Нужно написать элементарный скрипт, алгоритм работы такой, есть столбец

    Code:
    <font style="position: absolute;overflow: hidden;height: 0;width: 0">
    test1 <a href="http://xost.com/">test1</a> test1
    test2<a href="http://xost.com/">test2</a> test2
    test3<a href="http://xost.com/">test3</a> test3
    .
    .
    .
    </font>
    
    Надо просто чтобы я добавил в форму сее и это преобразовалось в сплошную строчку!

    Т.е. вот так чтобы получилось
    Code:
    <font style="position: absolute;overflow: hidden;height: 0;width: 0"> test1 <a href="http://xost.com/">test1</a> test1 test2<a href="http://xost.com/">test2</a> test2 test3<a href="http://xost.com/l">test3</a> test3...</font>
    
    Пишите в личку решение, я 5$ могу дать!
     
  2. fly

    fly Member

    Joined:
    15 Apr 2007
    Messages:
    584
    Likes Received:
    95
    Reputations:
    -10
    Один человек помог

    Ошибка выходит


    Код:

    <font style="position: absolute;overflow: hidden;height: 0;width: 0"> test1 <a href="http://xost.com/">test1</a> test1 test2<a href="http://xost.com/">test2</a> test2 test3<a href="http://xost.com/l">test3</a> </font>



    а получается так

    Код:

    <font style=\"position: absolute;overflow: hidden;height: 0;width: 0\">test1 <a href=\"http://xost.com/\">test1</a> test1test2<a href=\"http://xost.com/\">test2</a> test2test3<a href=\"http://xost.com/\">test3</a> test3</font>



    слеши почему вставляет "\"? кАК ЧТОБЫ БЕЗ НИХ?



    Сам скрипт
    Code:
    <?
      header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
      header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
      header("Cache-Control: no-store, no-cache, must-revalidate");
      header("Cache-Control: post-check=0, pre-check=0", false);
      header("Pragma: no-cache");
    
      if (isset($_POST['a']))
      die(str_replace(array("\r","\n"), "", $_POST['a']));
    
      echo "<form method=post>\r\n";
      echo "<textarea name=a rows=10 cols=40></textarea>\r\n";
      echo "<input type=submit>\r\n";
      echo "</form>\r\n";
    ?> 
    
     
    #2 fly, 8 Aug 2008
    Last edited: 8 Aug 2008
  3. Gifts

    Gifts Green member

    Joined:
    25 Apr 2008
    Messages:
    2,494
    Likes Received:
    807
    Reputations:
    614
    PHP:
    $str=<<<HTT
    <font style="position: absolute;overflow: hidden;height: 0;width: 0">
    test1 <a href="http://xost.com/">test1</a> test1
    test2<a href="http://xost.com/">test2</a> test2
    test3<a href="http://xost.com/">test3</a> test3
    .
    .
    .
    </font>
    HTT;
    $str=preg_replace("#\r\n#",'',$str);
     
    _________________________
    1 person likes this.
  4. banned

    banned Banned

    Joined:
    20 Nov 2006
    Messages:
    3,324
    Likes Received:
    1,194
    Reputations:
    252
    PHP:
    str_replace(array("\r","\n"), NULL$str)
     
  5. Piflit

    Piflit Banned

    Joined:
    11 Aug 2006
    Messages:
    1,249
    Likes Received:
    585
    Reputations:
    31
    PHP:
    die(str_replace(array("\r","\n"), ""stripslashes($_POST['a'])));
     
  6. fly

    fly Member

    Joined:
    15 Apr 2007
    Messages:
    584
    Likes Received:
    95
    Reputations:
    -10
    вСЕМ СПАСИБО)! ЗаКРЫТ вопрос!
     
Thread Status:
Not open for further replies.