how can remove unwanted characters on input text using php. have working version of javascript blocks specific characters. however, still can bypass script if user's javascript disabled. i'm interested on making php version.
my working javascript blocking specific characters "<>[]#='";()$&"
<input id="cleanify" placeholder="some text here"> <script type="text/javascript"> $('#cleanify').bind('keyup blur', function() { $(this).val($(this).val().replace(/[<>#=';",$&(\)[\]]/g,'_')) }); </script>
just use php's preg_replace wherever submitting form to.
ie.
$cleanify = preg_replace('/[<>#=\';",$&(\)[\]]/', '_');
Comments
Post a Comment