Hi, new to the forum and PHP so I'm hoping to get some help with the following problem. The problem I'm having is with duplicate values in an array.
I have a form where the user selects materials from ten select boxes, all populated with the same data. If the user tries to submit the form with the same value in two different fields, I would like the program to throw up an error.
So, this is what I have so far -->
if (array_unique($array) != $array) {
?>
<tr>
<td class="error">Error: You cannot select the same material on two different lines.</td>
</tr>
<?
$count=1;
return $count;
}
This works fine if the user selects something in all the fields but if they do not, then it throws up the error for the blank or null fields.
How can I modify the above to ignore blank fields and fields with a value of zero??
Any help would be greatly appreciated. Thanks.