SirChick Posted December 24, 2007 Share Posted December 24, 2007 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> Quote Link to comment https://forums.phpfreaks.com/topic/83045-problem-with-bbcode-input/ Share on other sites More sharing options...
papaface Posted December 24, 2007 Share Posted December 24, 2007 <?php=bbcode_format($Notes);?> should be: <?php echo bbcode_format($Notes);?> and make sure the HTML is below your function. Quote Link to comment https://forums.phpfreaks.com/topic/83045-problem-with-bbcode-input/#findComment-422406 Share on other sites More sharing options...
SirChick Posted December 24, 2007 Author Share Posted December 24, 2007 Is the function needed for inputting into the database? Or only needed for dealing with the echo? Cos that could be why this is not working. Quote Link to comment https://forums.phpfreaks.com/topic/83045-problem-with-bbcode-input/#findComment-422408 Share on other sites More sharing options...
papaface Posted December 24, 2007 Share Posted December 24, 2007 How am I supposed to know.... Quote Link to comment https://forums.phpfreaks.com/topic/83045-problem-with-bbcode-input/#findComment-422409 Share on other sites More sharing options...
SirChick Posted December 24, 2007 Author Share Posted December 24, 2007 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. Quote Link to comment https://forums.phpfreaks.com/topic/83045-problem-with-bbcode-input/#findComment-422411 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.