Hi, I have a postgresql database with a web interface and I need to check that the data being entered is valid for the field. I would like to be able to do this before submitting the form so the user can make any changes without having to fillout and submit the form again. This is a small database so performance is not an issue.
thanks in advanceWhat kind of data?A mix names, addresses, serial numbers, idnumbers. Nuneric and alpdanumeric plus dates.OK, how do you want them validated? Like what are you checking for and what format?
You'll most likely need regexp's.
For example, you could use a regexp to check a serial number and make sure it's in a certain form. Or you could use the date function (<!-- m --><a class="postlink" href="http://php.net/date">http://php.net/date</a><!-- m -->) to check the date.Yes I realise that, I could also use switch statements etc but I want scalability. A lot of the tables are lookups only, sometimes new values are added to these tables. So I was wondering is it possible to have these values in a flat file and access this file, loop through checking to see if the value entered is a match for any. also I would rather not have to write seperate bits of code for each input. I,m not fixed on how I want to do this I was hoping people would say this how I have done it etc...
to give me some idea of how to go about it.
thanks for your replies.
BobSorry, I can't give you any opinions on the best way to do this. But I know putting it in a database would be best because it would be much faster and easy to maintain..best bet it to have a check for each input.
but you have to decide what exactly you want to check for,
A mix names, addresses, serial numbers, idnumbers. Nuneric and alpdanumeric plus dates.
that is not thorough enough. you have to be exact. and you can't check for all of them in one fail swoop.
thanks in advanceWhat kind of data?A mix names, addresses, serial numbers, idnumbers. Nuneric and alpdanumeric plus dates.OK, how do you want them validated? Like what are you checking for and what format?
You'll most likely need regexp's.
For example, you could use a regexp to check a serial number and make sure it's in a certain form. Or you could use the date function (<!-- m --><a class="postlink" href="http://php.net/date">http://php.net/date</a><!-- m -->) to check the date.Yes I realise that, I could also use switch statements etc but I want scalability. A lot of the tables are lookups only, sometimes new values are added to these tables. So I was wondering is it possible to have these values in a flat file and access this file, loop through checking to see if the value entered is a match for any. also I would rather not have to write seperate bits of code for each input. I,m not fixed on how I want to do this I was hoping people would say this how I have done it etc...
to give me some idea of how to go about it.
thanks for your replies.
BobSorry, I can't give you any opinions on the best way to do this. But I know putting it in a database would be best because it would be much faster and easy to maintain..best bet it to have a check for each input.
but you have to decide what exactly you want to check for,
A mix names, addresses, serial numbers, idnumbers. Nuneric and alpdanumeric plus dates.
that is not thorough enough. you have to be exact. and you can't check for all of them in one fail swoop.