Your error comes from these two lines:
$yourpost = $_POST['txt_post'];
$yourpost = bbcode($the_post);
Notice that the variable containing the post is $yourpost, but the one you're trying to bbcode is $the_post. Since $the_post is not set anywhere it counts as an empty string. Just change $the_post to $yourpost and it should work.
ok to get it to work i had to get rid of strip tags is there a way to get it to work were people can still use [ these ] those but still get rid of html code?
I wouldn't have thought that strip_tags would strip bbcode, but you could try replacing it with htmlspecialchars() instead. Only problem with that is someone could probably insert on click events etc. into the bbcode tags and they wouldn't get removed, allowing users to run whatever javascript they wanted. Twitter had a lot of problems with this recently.