Help: Function to remove phone number and email address from a field

I have this code on the submit.php file, but I am getting a syntax error.

function check_fields()
{

$HTTP_POST_VARS[‘brief’]=preg_replace("/0,1,2,3,4,5,6,7,8,9/", /www/",/@/",""$HTTP_POST_VARS[‘brief’]);

}

Please help. I need to delete or remove phone numbers, web address and email from the brief field. Many thanks

You can’t set a post that way.

Also, what is this inside the preg-replace???

“/0,1,2,3,4,5,6,7,8,9/”,/www/",/@/",""$HTTP_POST_VARS[‘brief’]

Broken down:
“/0,1,2,3,4,5,6,7,8,9/”,
/www/",
/@/",
“”
$HTTP_POST_VARS[‘brief’]

Not sure what you were typing there. Here is a link on the preg_replace setup. Some of the samples further down the page might help… http://php.net/manual/en/function.preg-replace.php

This version will dump all numbers and keep just alpha’s:
$outputString = preg_replace(’/[^a-z]/i’, ‘’, $InputString)

Also, here is a great list of general ways to use preg_replace to remove or catch various items…
http://davebrooks.wordpress.com/2009/04/22/php-preg_replace-some-useful-regular-expressions/

Good luck, hope this helps…

Sponsor our Newsletter | Privacy Policy | Terms of Service