I trying to validate a number of inputbox which have array name. this time i am using a validation script which is in php. (http://www.html-form-guide.com/php-form/php-form-validation.html)
< form name="form1" action="page1.php" method="POST"><br/>
<br>
< input type=text name="value[]" /><br/>
< input type="text" name="value[]" /><br/>
< input type="text" name="value[]" /><br/>
<br/>
< input type="submit" name=""/>
<br/><br/>
< /form>
I read the validation script but I am unable to find the validation for array can any one suggest how its work.
At a glance, your validation class does not support arrays of values. However, don’t despair, there are ways around that! (An easy way is just to ditch that class in favour of other, more open, alternatives).
You now have three choices:
We’ll go over option 3. There is a little known fact, which is that _POST is read-write and not just read-only. It is a very, very bad practice, but for this instance, it’ll work. You will want to iterate on your array and reassign new names to all of them… Then run the validation on those names.
Cheeky fix, but it allows you to not have to ditch the code. However, if you’re planning on using this more than once, I’d strongly recommend spending 5 minutes to implement solution #1 or #2.