Say I have 20 variables all being submitted from a form by a user. I want to remove the special characters in them.
This doesn't work:
$fields_to_parse=array("var1","other 19 vars");
while (list($null,$field)=each($fields_to_parse)) {
$page_name=ereg_replace("[.,`~!@#$%&+=*;'\/():<>?|{}]","",$field);
}
What's a good way of doing this? Oh, and how do I remove regular brackets?
By the way LordShryku, before you say "I thought you were going to use str_replace", it wouldn't worked with my header. One of the variables is the page name and the header redirects to it. But with str_replace I get sent to 404ville. ereg_replace sends me to $pagename. 🙂