[Phpwm] Cleaning up addresses

David Goodwin david at codepoets.co.uk
Mon Mar 19 13:23:38 GMT 2007


alan dunn wrote:
> We are getting addresses in from field users - in theory up to 3 
> discreet address lines, followed by Town, County, Post Code etc. The 
> address fields contain an amazing amount of rubbish - we had one with 
> about 5 additional carriage returns between each line.
> Does anyone have a favourite thorough approach to cleaning this sort of 
> stuff up?
> alan dunn

I/we use Propel's validation rules, which effectively pass each field 
through a regexp (or similar). If it contains crap (fails validation), 
then submission of the form doesn't succeed and the user is given the 
chance to fix the offending field with an appropriate error message shown.

There is no way to save data into the database unless it passes propel's 
validation rules (unless of course I write the SQL query myself).

Cleaning up crap data can be quite hard to automate. If it's only a few 
fields, I'd be tempted to do it manually, otherwise - hire a temp, or 
delete it.

David.

( http://propel.phpdb.org )


-- 
David Goodwin

[ david at codepoets dot co dot uk ]
[ http://www.codepoets.co.uk       ]



More information about the Phpwm mailing list