View Single Post
Old 07-28-2002, 12:41 PM   PM User | #1
sanuk
New Coder

 
Join Date: Jul 2002
Posts: 20
Thanks: 0
Thanked 0 Times in 0 Posts
sanuk is an unknown quantity at this point
Question Cleaning form submited strings

Hi Friends,
I need a method for cleaning strings from all NON alphabetic and numeric characters that are submitted by a form

I have the following strings:
$data1 - $data2 and $data3
before writing these 3 strings to file, I want to eleminate all characters that are not a-z, A-Z and 0 to 9 and replace them with nothing, not even a blank.
Meaning if $data1 = "my tel # 025/123.895.548"
should become $data1 = "my tel 025123895548"

Then I need the same as above but also eleminating blank spaces
such as:
$data5 = "map &125 #abc <small"
becomes
$data5 = "map25abcsmall"

And to make things even worse I need a very difficult one
That eleminates everything that is not a number or a decimal point.
$data6 = "Temperature for city $manoi <b>40.08</b> celcius"
becomes
$data6 = "40.08"

Best Regards,
Sanuk
sanuk is offline   Reply With Quote