Hi have a problem in that I want to validate an array which is consecutive numbers from 1 to 18. Say, for example I have ten numbers 1 2 3 4 6 7 8 9 11 12 posted from my form, I need to loop through the result 18 times and if a number is missing(false), which is 4 in this example, it will print out the number and a variable which I will assign (in this example I used "data added".
the results I get are as follows:
1 1: valid
2 2: valid
3 3: valid
4 4: valid
6 6: Data Added
7 7: valid
8 8: valid
9 9: valid
11 11: Data Added
12 12: valid
as you can see it missed out 5 and 10 and recognised 6 as false and 11 as false eventhough they are in my results
Reality is built on a foundation of dreams.
the results I get are as follows:
1 1: valid
2 2: valid
3 3: valid
4 4: valid
6 6: Data Added
7 7: valid
8 8: valid
9 9: valid
11 11: Data Added
12 12: valid
as you can see it missed out 5 and 10 and recognised 6 as false and 11 as false eventhough they are in my results
Code:
foreach($_POST[quest_index] as $checker){
if($validator == $checker){
print "$validator $checker: valid<br>";
$validator++;
}else{
$validator++;
print "$validator $checker: Data Added<br>";
$validator++;
}
}
Reality is built on a foundation of dreams.