note 71514 deleted from function.preg-replace by nlopess

From: Date: Mon, 04 Dec 2006 18:49:47 +0000
Subject: note 71514 deleted from function.preg-replace by nlopess
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-120278@lists.php.net to get a copy of this message
Note Submitter: pat ---- Hi I use a form with a textarea. when i see an error with entered data, i call back the same form script. by using the nl2br fonction in my textaera validation scritp, it modifies the textearea content with "<br />" but each time i submit, if in other field contens error, it adds a new "<br />" in the textarea content. i made this but it does not work. As i'm new, i would appreciate some help... $str['a'] = preg_replace('/^({<br />})+$/','<br />',$str['a']); by the way, anyone made some script to secure the content entered in a textarea? to avoid security issues? $str['a'] = str_replace('<?php>','',$_REQUEST['a']); $str['a'] = str_replace('<?>','',$str['a']); $str['a'] = str_replace('?>','',$str['a']); $str['a'] = str_replace('<html>','',$str['a']); $str['a'] = str_replace('</html>','',$str['a']); $str['a'] = str_replace('<body>','',$str['a']); $str['a'] = str_replace('</body>','',$str['a']); $str['a'] = str_replace('<div>','',$str['a']); $str['a'] = str_replace('</div>','',$str['a']); $str['a'] = str_replace('<ul>','',$str['a']); $str['a'] = str_replace('<li>','',$str['a']); $str['a'] = htmlspecialchars(nl2br($str['a'])); $str['a'] = preg_replace('/^({<br />})+$/','<br />',$str['a']);

« previous php.notes (#120278) next »