Jump to content

BB code function not working


SirChick

Recommended Posts

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

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>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.