tags:

views:

101

answers:

2

Dear All

I have 10 input or more and need to check for this array do not duplicate. if duplicate entry from user will be show that error to user too.

sample

Check array qty[] if dup. will be show and can not entry

<input name="qty[]" type="text" class="InputBox" id="<? echo "qty".$i?>" onBlur="sumTotal('qty[]')" onChange="sumTotal('qty[]')" value="0" size="5">
<input name="qty[]" type="text" class="InputBox" id="<? echo "qty".$i?>" onBlur="sumTotal('qty[]')" onChange="sumTotal('qty[]')" value="0" size="5">
<input name="qty[]" type="text" class="InputBox" id="<? echo "qty".$i?>" onBlur="sumTotal('qty[]')" onChange="sumTotal('qty[]')"  value="0" size="5">
<input name="qty[]" type="text" class="InputBox" id="<? echo "qty".$i?>" onBlur="sumTotal('qty[]')" onChange="sumTotal('qty[]')" value="0" size="5">
<input name="qty[]" type="text" class="InputBox" id="<? echo "qty".$i?>" onBlur="sumTotal('qty[]')" onChange="sumTotal('qty[]')" value="0" size="5">
<input name="qty[]" type="text" class="InputBox" id="<? echo "qty".$i?>" onBlur="sumTotal('qty[]')" onChange="sumTotal('qty[]')"  value="0" size="5">
<input name="qty[]" type="text" class="InputBox" id="<? echo "qty".$i?>" onBlur="sumTotal('qty[]')" onChange="sumTotal('qty[]')" value="0" size="5">
<input name="qty[]" type="text" class="InputBox" id="<? echo "qty".$i?>" onBlur="sumTotal('qty[]')" onChange="sumTotal('qty[]')" value="0" size="5">
<input name="qty[]" type="text" class="InputBox" id="<? echo "qty".$i?>" onBlur="sumTotal('qty[]')" onChange="sumTotal('qty[]')"  value="0" size="5">
<input name="qty[]" type="text" class="InputBox" id="<? echo "qty".$i?>" onBlur="sumTotal('qty[]')" onChange="sumTotal('qty[]')" value="0" size="5">

I am try in 1 weeklate till now can not. Please help me.

Best Regards, Vilart

+1  A: 
// $qty is the array you want to check for duplicates
$has_duplicates = (count(array_unique($qty)) != count($qty));

if ($has_duplicates) {
   // do something
}
Dominic Rodger
A: 

This one on the function on php or Javascript.

if you have time,please kindly explan to stupid man.

And like to tell you I am very wrong in English too.

Vilart