Hi,
I programmed a script for questions and answers, a user type a question then submit it to the database, I don't want to allow visitors type html codes to database ?
Thanks
You can simply strip them out of the input with [man]strip_tags/man. Or if you want to generate an error at the form and have the user re-submit:
if($_POST['question'] != strip_tags($_POST['question'])) { // input error } else { // valid input }
Thank you very much !
strip_tags() will remove html codes only or what ?
for example a visitor sent :-
I <b>Have</b> question
the strip_tags() will remove the <b></b> ?
strip_tags will remove all html and php. It does not validate the code though
thank you very much guy's