Jump to content

Problem with bbcode input


SirChick

Recommended Posts

I have a textarea which is meant to echo the text with bbcode but it is not working...  i got this error:

 

 

<b>Fatal error</b>:  Call to undefined function  bbcode_format() in <b>C:\xampp\htdocs\pendingreports.php</b> on line <b>80</b>

 

This is what i got for the input of the text:

<?php
$Notes =  mysql_real_escape_string($_POST['TextArea1']);
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);

        return $Notes;
}
If($Notes == ''){
Header("pendingreports.php");
}Else{
	$UPDATE = mysql_query("UPDATE reportedusers SET StaffNotes='$Notes' WHERE RecordID='$RecordID'")
	or die(mysql_error());
	Header("location: pendingreports.php?view=$RecordID");
}
?>

 

 

Then i echo it here:

 

<textarea name="TextArea1" id="TextArea1" style="position:absolute;left:67px;top:31px;width:325px;height:254px;z-index:0" rows="14" cols="33">
<?php=bbcode_format($Notes);?></textarea>

 

Link to comment
https://forums.phpfreaks.com/topic/83045-problem-with-bbcode-input/
Share on other sites

Well i presumed u knew as you were helping fix my problem..some one else gave me this function to use but i don't know if its meant to be used before the input to the database or only on the output of an echo. Or both.

 

How ever it didn't work just to add the error no longer appears but the echo comes out blank.

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.