mike1313 Posted November 26, 2007 Share Posted November 26, 2007 I have a chat script and everytime the user enters an html tag that isnt <B><I><U><S> it returns as a blank message. Using strip_tags($message, '<B><U><I><S>'); So if I entered <TD> it would display as blank and screw the whole page layout up. Any ideas on how I could fix this? Any help appreciated. Quote Link to comment Share on other sites More sharing options...
redarrow Posted November 26, 2007 Share Posted November 26, 2007 use str_replace('<b>',' '); Quote Link to comment Share on other sites More sharing options...
mike1313 Posted November 26, 2007 Author Share Posted November 26, 2007 Yeah but that's not feasible because I'd have to use it for every single tag that isn't font related. Is there a way to make a variable to where it searches for a tag <TD> for example and if its in the string to put a </TD> automatically at the end? Quote Link to comment Share on other sites More sharing options...
PHP_PhREEEk Posted November 26, 2007 Share Posted November 26, 2007 It could search and using strpos put the </td> right next to it, but as far as putting it 'at the end', well, PHP would ahve no idea where 'the end' is assuming the end would be the end of some string. If you can narrow 'the end' down to the next white-space, next period, next whatever, then PHP could put it there. If you're building a chat environment, you might want to implement BBCode style tags for users to use. It's much better suited for what you are apparently doing. There have been many discussions around here, so search the forum. PhREEEk Quote Link to comment 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.