SirChick Posted January 24, 2008 Share Posted January 24, 2008 I have this function that is suppose to show fonts in bold etc using html but it just shows it as like normal: <b>tst</b> ^thats how it shows rather than : tst This is my function: function bbcode_format($Notes){ $Notes = htmlentities($Notes); $simple_search = array( '/\[b\](.*?)\[\/b\]/is' ); $simple_replace = array( '<strong>$1</strong>' ); // Do simple BBCode's $Notes = preg_replace ($simple_search, $simple_replace, $Notes); echo $Notes; } Link to comment https://forums.phpfreaks.com/topic/87611-bb-code-function-not-working/ Share on other sites More sharing options...
beansandsausages Posted January 24, 2008 Share Posted January 24, 2008 try this : $words = array('[b]','[/b]'); $code = array('<strong>','</strong>'); $Notes= str_replace($words, $code, $Notes); Link to comment https://forums.phpfreaks.com/topic/87611-bb-code-function-not-working/#findComment-448114 Share on other sites More sharing options...
SirChick Posted January 24, 2008 Author Share Posted January 24, 2008 Nah didn't work this is the script: function bbcode_format($Notes){ $Notes = htmlentities($Notes); $simple_search = array( '/\[b\](.*?)\[\/b\]/is' ); $words = array('[b]','[/b]'); $code = array('<strong>','</strong>'); $Notes= str_replace($words, $code, $Notes); echo $Notes; } <textarea name="TextArea1" rows="14" cols="80"><?=$Notes?></textarea> Link to comment https://forums.phpfreaks.com/topic/87611-bb-code-function-not-working/#findComment-448172 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.