hakimserwa Posted July 21, 2012 Share Posted July 21, 2012 htmlentities but i have tested it numerously but if it failed a simple <br /> then i would really like to look somewhere else. please help if there is just a way of not even passing them but just triger an error if one is found. Link to comment https://forums.phpfreaks.com/topic/266052-what-would-be-better-way-to-remove-any-html-related-character-from-a-form-input/ Share on other sites More sharing options...
jcbones Posted July 21, 2012 Share Posted July 21, 2012 To remove them? strip_tags. Link to comment https://forums.phpfreaks.com/topic/266052-what-would-be-better-way-to-remove-any-html-related-character-from-a-form-input/#findComment-1363319 Share on other sites More sharing options...
hakimserwa Posted July 21, 2012 Author Share Posted July 21, 2012 thank will try this Link to comment https://forums.phpfreaks.com/topic/266052-what-would-be-better-way-to-remove-any-html-related-character-from-a-form-input/#findComment-1363321 Share on other sites More sharing options...
hakimserwa Posted July 21, 2012 Author Share Posted July 21, 2012 strip_tags() doesnt strip <br/> also please advise on better way to keep html or any related tags from my form inputs. Link to comment https://forums.phpfreaks.com/topic/266052-what-would-be-better-way-to-remove-any-html-related-character-from-a-form-input/#findComment-1363325 Share on other sites More sharing options...
xyph Posted July 21, 2012 Share Posted July 21, 2012 Do you want to strip them, or cause them to display as text? <?php $string = '<br />'; echo $string; echo "\n"; echo htmlentities($string); ?> output <br /> <br /> Works fine for me. Keep in mind, htmlentities and htmlspecialchars should be given an encoding value, if needed. Please specify how you're using these functions. <?php $string = '<br/>'; echo strip_tags($string); ?> Produces no output for me, so you probably aren't implementing it correctly. Link to comment https://forums.phpfreaks.com/topic/266052-what-would-be-better-way-to-remove-any-html-related-character-from-a-form-input/#findComment-1363330 Share on other sites More sharing options...
hakimserwa Posted July 21, 2012 Author Share Posted July 21, 2012 i use them during validation. if(!trim(strip_tags($first_name))){ Link to comment https://forums.phpfreaks.com/topic/266052-what-would-be-better-way-to-remove-any-html-related-character-from-a-form-input/#findComment-1363337 Share on other sites More sharing options...
xyph Posted July 21, 2012 Share Posted July 21, 2012 You're using it incorrectly. The manual, and my examples, shows you what kind of values you should expect the function to return. Link to comment https://forums.phpfreaks.com/topic/266052-what-would-be-better-way-to-remove-any-html-related-character-from-a-form-input/#findComment-1363338 Share on other sites More sharing options...
hakimserwa Posted July 21, 2012 Author Share Posted July 21, 2012 got it thank you very much Link to comment https://forums.phpfreaks.com/topic/266052-what-would-be-better-way-to-remove-any-html-related-character-from-a-form-input/#findComment-1363355 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.