• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Compare array Value's from multiple input forms

#1
[eluser]fsw[/eluser]
How do you compare array value from this

Code:
<div style="margin: 10px 0pt;" class="result-container">
<p class="list">
<span class="listed">
List Objek:value1
</span>
&lt;input type="hidden" value="1" name="op_value[]" id="op_value"/&gt;
<a class="remove">[remove]</a>
</p>
<p class="list">
<span class="listed">List Objek:value2
</span>
&lt;input type="hidden" value="1" name="op_value[]" id="op_value"/&gt;
<a class="remove">[remove]</a>
</p>
<p class="list">
<span class="listed">List Objek:value3
</span>
&lt;input type="hidden" value="1" name="op_value[]" id="op_value"/&gt;
<a class="remove">[remove]</a>
</p>

I need user to only submit 1 item for every value they choose, if there's a same item in the array then it's validated wrong because the user choose the same item twice.

thanks in advance.

#2
[eluser]fsw[/eluser]
Anyone please help...

#3
[eluser]verynewtothis[/eluser]
Try writing a custom validation which would use array_unique function.. This will tell you if there is a duplicate entry exists or not.

Code:
http://www.php.net/array_unique

User guide on writing a custom validation:

Code:
http://ellislab.com/codeigniter/user-guide/libraries/form_validation.html#callbacks


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


Users browsing this thread:
1 Guest(s)


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.