Po wygenerowaniu tego kodu przez generator bbcode (http://bbcode.strefaphp.net/bbcode.php):
<?php // bbcode Function bbcode($str){ // usun zbedne // Pogrubiony tekst // Pochylony tekst // Podkreślony tekst // Kolor tekstu // kolejny wiersz // js // wynik return $str;} // anti js Function bbcode_js($str){ }else{return $str[0];}} ?>
Kod ten dałem do bbcode.php, a w pliku news.php napisałem:
<?php echo ' <form method="POST" action="news.php?dodaj=dodaj"> <table> <tr> <td>Tytuł</td> <td><input type="text" name="tytul"> </tr> <tr> <td>Data</td> <td><input type="text" name="data"> (np. 16 sierpnia 2008) </tr> <tr> <td>Tresć</td> <td><textarea name="tresc" cols="40" rows="15">Tresć</textarea></td> </tr> <td><input type="submit" value="Dodaj news"></td> </tr> </table> </form> '; } elseif($_GET['dodaj'] == 'dodaj') { $tytul = $_POST['tytul']; $data = $_POST['data']; $tresc = $_POST['tresc']; $autor = $user['user']; if(!$tytul || !$data || !$tresc) { require('../include/foot.php'); exit; } require("bbcode.php"); bbcode($tresc); mysql_query("INSERT INTO news (tytul, data, tresc, autor) values ('$tytul', '$data', '$tresc', '$autor')") or die ('Error: ' . mysql_error()); ?>
Jednak gdy wpisuję w treści newsa np. [ b ]test[ /b ] (bez spacji), to w wyświetlaniu newsów na stronie głównej pokazuje się właśnie [ b ]test[ /b ] (bez spacji) a nie test ;/
Może mi ktoś pomóc?
Pozdrawiam!