How can I add <br/> tags to data gotten from a text box and are there any special characters I should delete (characters which people normally use to hack databases and urls)?
if it's a large textbox, nl2br() the text. DO NOT write your own queries - use prepared statements/stored procedures
Right! if you need to demolish the things that hacks DB Put on the other side to match and replace that and after Process and Execute the Query
I tested it and it isn't working. My Test Code: $var = "Test\nText"; $var = nl2br($var, true); //This statement says that I have an incorrect amount of parameters in the command echo($var); Code (markup): I need the <br/> tags to be strict compliant. (Not <br>. Needs to be <br/>) I basically need a function which will replace all newlines (When the user presses the 'Enter' Key) from a textbox with <br/> tags so it can be outputed as html. I also need a function which will replace all second spaces which so it can also be printed out as html. Is there a function which will do all this quickly? Thank you.
Read the documentation if no second paremeter (is_xhtml) is postively defined it will use the xhtml br tag by default, theirfore if it is (which you have done) it will display the non-xhtml-valid br tag. Change: $var = nl2br($var, true); PHP: Too: $var = nl2br($var); PHP:
Okay. What about this part of my question. I also need a function which will replace all second spaces with so it can also be printed out as html. Is there a function which will do all this quickly?