Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> Problem z preg_replace
Hpsi
post
Post #1





Grupa: Zarejestrowani
Postów: 483
Pomógł: 50
Dołączył: 15.03.2005
Skąd: Poznań

Ostrzeżenie: (0%)
-----


  1. <?php
  2. $string = preg_replace('/{input::(.+)::(.+)?}/', '<input type=\"1\" name=\"2\" value=\"'.$r['2'].'\" />', $string);
  3. ?>

Problem polega na to ze mając w Tablicy $r['nick'] informacje, skrypt mi je pomija tak jakby talibca wogule nie istniala, gdy zrobie print_r($r); to mi pokazuje.

preg dziala w 100% dobrze prócz tego value="'.$r['\\2'].'" nie wiem dlaczego.
Proszę o pomoc
Go to the top of the page
+Quote Post
SongoQ
post
Post #2





Grupa: Przyjaciele php.pl
Postów: 2 923
Pomógł: 9
Dołączył: 25.10.2004
Skąd: Rzeszów - studia / Warszawa - praca

Ostrzeżenie: (0%)
-----


  1. <?php
  2.  
  3. $string = preg_replace('/{input::(.+)::(.+)?}/', '$a = '<input type=&#092;"$1\" name=\"$2\" value=\"'.$r['$2'].'\" />';', $string);
  4. eval($string);
  5. $string = $a;
  6.  
  7. ?>


Hm jedno z rozwiazan to takie (IMG:http://forum.php.pl/style_emoticons/default/smile.gif)
Go to the top of the page
+Quote Post
Hpsi
post
Post #3





Grupa: Zarejestrowani
Postów: 483
Pomógł: 50
Dołączył: 15.03.2005
Skąd: Poznań

Ostrzeżenie: (0%)
-----


problem tkwi w tym, że to nie dziala w odpowieni sposob raz:

Parse error: parse error, unexpected '<' in library/skorka.php(256) : eval()'d code on line 1
Go to the top of the page
+Quote Post
SongoQ
post
Post #4





Grupa: Przyjaciele php.pl
Postów: 2 923
Pomógł: 9
Dołączył: 25.10.2004
Skąd: Rzeszów - studia / Warszawa - praca

Ostrzeżenie: (0%)
-----


Kod jest ok, sprawdzalem i sie parsuje, blad musi byc gdzies indziej.
Go to the top of the page
+Quote Post
Hpsi
post
Post #5





Grupa: Zarejestrowani
Postów: 483
Pomógł: 50
Dołączył: 15.03.2005
Skąd: Poznań

Ostrzeżenie: (0%)
-----


problem roziwany kod:
  1. <?php
  2.  
  3. $string = preg_replace('/{input::(.+)::(.+)?}/e', ' '<input type=&#092;"1\" name=\"2\" value=\"'.$r['2'].'\" />'; ', $string);
  4. $string = preg_replace('/{textarea::(.+)::(.+)::(.+)?}/e', ' '<textarea name=&#092;"1\" rows=\"2\" cols=\"3\" />'.$r['1'].'</textarea>'; ', $string);
  5. return $string;
  6.  
  7. ?>


Dziękuje za pomoc

Ten post edytował Hpsi+ 11.06.2005, 10:15:52
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 23.08.2025 - 07:51