Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [php]Pobieranie danych z bazy, i wyświetlanie w polu textarea.
Ennioasofaroman
post
Post #1





Grupa: Zarejestrowani
Postów: 5
Pomógł: 0
Dołączył: 21.05.2010

Ostrzeżenie: (10%)
X----


Witam, mam problem...

Otóż ostatnio tworzyłem system profili do mojej strony, i zrobiłem do niego system bbcode. BBcode dobrze działa, ponieważ wcześniej go testowałem, ale nie działa wyświetlanie tekstu pobieranego z bazy, przefiltrowanego funkcją bbcode w polu textarea... Tak wygląda mój kod:

  1. <br><b><h3>Edycja profilu</h3></b>
  2. <form action="aktualizuj.php" method="post">
  3. <textarea name="profil" cols="10" rows="10" style="background-color: #E3DEE1; width: 60%; height: 110%; border-style: dashed; border-color: #000000"><?php
  4. require('conn.php');
  5.  
  6. $login=$_SESSION['login'];
  7.  
  8.  
  9. $wynik = mysql_query("SELECT profil FROM user WHERE login='$login'")
  10. or die('Błąd zapytania');
  11. while($r = mysql_fetch_assoc($wynik)) {
  12.  
  13.  
  14. $tekst=$r['nick'];
  15.  
  16.  
  17.  
  18.  
  19.  
  20. function bbcode($tekst) { //Funkcja
  21. $tekst = htmlspecialchars($tekst); //Tagi HTML
  22. $tekst = preg_replace("#\[b\](.*?)\[/b\]#si", "<b>\\1</b>", $tekst); //Pogrubienie
  23. $tekst = preg_replace("#\[i\](.*?)\[/i\]#si", "<i>\\1</i>", $tekst); //Pochylenie
  24. $tekst = preg_replace("#\[u\](.*?)\[/u\]#si", "<u>\\1</u>", $tekst); //Podksreślenie
  25. $tekst = preg_replace("#\[color=(http://)?(.*?)\](.*?)\[/color\]#si", "<span style=\"color: \\2\">\\3</span>", $tekst); //Kolor
  26. $tekst = preg_replace("#\[size=(http://)?(.*?)\](.*?)\[/size\]#si", "<span style=\"font-size: \\2\">\\3</span>", $tekst); //Rozmiar
  27. $tekst = preg_replace("#\[url\](.*?)\[/url\]#si", "<a href=\"\\1\">\\1</a>", $tekst); //Link
  28. $tekst = preg_replace("#\[url=(http://)?(.*?)\](.*?)\[/url\]#si", "<a href=\"\\2;\">\\3</a>", $tekst); //Link
  29. $tekst = preg_replace("#\[img\](.*?)\[/img\]#si", "<img src=\"\\1\">", $tekst); //Obrazek
  30. $tekst = preg_replace("#\[img=(http://)?(.*?)\](.*?)\[/img\]#si", "<img src=\"\\2\" alt=\"\\3\">", $tekst); //Obrazek
  31. $tekst = preg_replace("#\[quot\](.*?)\[/quot\]#si", "<blockquot>\\1</blockquot>", $tekst); //Cytat
  32. $tekst = preg_replace("#\[code\](.*?)\[/code\]#si", "<pre>\\1</pre>", $tekst); //Kod
  33. $tekst = nl2br($tekst); //Następna linijka
  34. return $tekst; //Wyjście
  35. }
  36. $result = bbcode("$tekst"); //Użycie funkcji
  37.  
  38.  
  39.  
  40.  
  41.  
  42. echo bbcode("$result");
  43. }
  44.  
  45.  
  46. ?>
  47.  
  48.  
  49.  
  50.  
  51. </textarea>
  52. <br>
  53.  
  54. <input type="submit" value="Zmień" />


Mam nadzieję, że mi ktoś pomoże... Pozdrawiam
Powód edycji: [strife]: Przenoszę na Przedszkole
Go to the top of the page
+Quote Post

Posty w temacie


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: 26.09.2025 - 21:13