javascript string replace equivalent on php?
<p>I am trying to prevent xss injection.
So before I submit a form, a javascript function is called</p>

<pre><code>function validatefield(id) {
    var description = document.getElementById(id).value;   
    description = description.replace(/[\"\'][\s]*javascript:(.*)[\"\']/gi, "");
    description = description.replace(/script(.*)/gi, "");    
    description = description.replace(/eval\((.*)\)/gi, "");
    document.getElementById(id).value=description;
} 
</code></pre>

<p>I am wonderng if there's a way to do the same in php before inserting into the mysql? if they get around of the validatefield function.</p>

<p>Thanks</p>
