View Full Version : need to restricting forms submits based on data

01-16-2008, 05:55 PM
I have a form located here https://www.lgw.com/dev/sampleformcard.htm

and I'd like to stop people from submitting the form if there credit card starts with several different combination of 4 numbers.

The list is very long (almost 300 different combo) and I was looking for suggestions on how I could accomplish this.

My first thought was it break up the one field into 4 fields, (like the four groups of numbers on your credit card) and just run the filter on the first field.

would I use JavaScipt and run it against a CSV file? or maybe PHP?

Any direction would be helpful.


01-16-2008, 06:58 PM
Well, if it's critical that CC numbers that start with those digits don't get submitted, you should avoid javascript - since anyone with javascript turned off could bypass it.

Server side, whatever language you want should work. I'd put the numbers in a file, run through the file creating an array/hash of bad numbers, then do a simple "if" check to see if the number submitted is in that array/hash.

01-16-2008, 07:04 PM
anyway I could just get an simple example I could learn off of?

is this in PHP or something else?