![]() |
![]() |
![]()
Post
#1
|
|
Grupa: Zarejestrowani Postów: 35 Pomógł: 0 Dołączył: 16.06.2003 Ostrzeżenie: (0%) ![]() ![]() |
Problem wygląda tak:
- chciałbym by w poniższym kodzie zamiast $i pojawiały się kolejne cyfry - ale jakoś nie mam pomysłu jak to zrobić by działało szybko i sprawnie: Mam taki kod narazie: [php:1:261a14ab4c]<?php if(preg_match_all("#[ankieta](.+)[/ankieta]#s",$in,$matches)) { $trans_ankieta_array=array( "#[ankieta](.+)[/ankieta]#s"=>"<form action="index.php?d=forumankieta" method="post">1 <input type="submit" vaule="Wyœlij"></form>", "!- (.*)!U"=>"<input type="radio" name="vote_id" value="".$i."" />1 " ); $in2 = ereg_replace_multi($trans_ankieta_array, $matches[0][0]); $in=preg_replace("#[ankieta](.+)[/ankieta]#i",">1</form>",$in2); #echo "<h1> $in2 </h1>"; } ?>[/php:1:261a14ab4c] |
|
|
![]() |
![]()
Post
#2
|
|
Grupa: Zarejestrowani Postów: 35 Pomógł: 0 Dołączył: 16.06.2003 Ostrzeżenie: (0%) ![]() ![]() |
Dzięki. Ładne i czytelne - ale chodziło mi o takie działanie jak poniżej:
[php:1:6afa43ddff]<?php if(preg_match_all("#[ankieta](.+)[/ankieta]#s",$in,$matchess)) { $in2=preg_replace("#[ankieta](.+)[/ankieta]#s", "<form action="index.php?d=forumankieta" method="post">1 <input type="submit" value="Wyœlij"></form>", $matchess[0][0]); $i=1; preg_match_all("!- (.*)!i",$in2,$matches); foreach($matches[0] as $inn) { $in2=ereg_replace($inn,ereg_replace("- ","<input type="radio" name="vote_id" value="".$i."" >",$inn),$in2); $i++; } $in=ereg_replace("[ankieta](.*)[/ankieta]",$in2,$in); } ?>[/php:1:6afa43ddff] Niby funkcja ta jest porpawna - ale nie dziąła najlepiej Może da się to jakoś zoptymalizować? |
|
|
![]() ![]() |
![]() |
Aktualny czas: 13.10.2025 - 10:01 |