I'm trying to validate an input form, for database INSERT/UPDATE.  I'm
looking for a couple of Techniques and I cant seem to find examples
anywhere:

1.      Validate Alpha Text with spaces, such as NAME, CITY, STATE, but limit the
length of each one separately, and remove unwanted characters like
'@!"£$%^&*() etc that might mess with the SQL.

2.      As above but alphanumeric with spaces etc. for say ADDRESS1 ADDRESS2
POSTCODE, etc.

3.      Validate DATE/TIME input to DD-MM-YYYY HH:MM:SS or D-M-YYYY H:M:S, or any
combination, but only allow valid dates and times, or as close to it as
possible.

4.      Validate MONEY input...numeric with 2 decimal places only.

Also, what is the best way to allow some fields to be empty, like ADDRESS2,
but if they have data, then validate it.

I've tried several times to do these myself using eregi, but when I test it,
the validation fails in some way...I'm shooting in the dark tho, and don't
really understand regex just yet, or probably the majority of PHP for that
matter.

Thankfully I've got an email one... it was easy to find, since that's what
all examples are geared for.  My application is for updating a DB with SQL,
and I cant find anything suitable.

If there is any other advice for data input into DB's regarding security,
I'd really to hear it.

Thanks in advance for any help at all!

Simon H


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to