Question: I have 2 input boxes for first name and last name of passengers travelling.  

There could be maximum 9 number of passengers.  

It is not allowed to have two passengers with same name(first and last combined)
How can I check if none of the passenger have same names(first and last name combined)

```
<input type="text" name="adultFirstName1" id="adultFirstName1" class="form-control input-sm" placeholder="" style="width:100%; padding:5px;">

```

Thanks.

**Edit:** 

I am not using a database to store the passenger names and the passengers are all entered on the same page.

Answer: 
```
var name=[];    
var sameName=false;
for(var i=1;i<=<%=detailsModel.getNumberOfAdult()%>;i++)
 {
var fullName = document.getElementById("adultFirstName"+i).value+" "+document.getElementById("adultLastName"+i).value
name.push(fullName);
}
for(var i=1;i<=<%=detailsModel.getNumberOfChild()%>;i++)
{
var fullName = document.getElementById("childFirstName"+i).value+" "+document.getElementById("childLastName"+i).value
name.push(fullName);

}
for(var i=1;i<=<%=detailsModel.getNumberOfInfant()%>;i++)
{
var fullName = document.getElementById("infantFirstName"+i).value+" "+document.getElementById("infantLastName"+i).value
name.push(fullName);
}
for(var i=0;i<name.length;i++)
{
for(var j=i+1;j<name.length;j++)
    {
    if(name[i]==name[j])
    {
        var sameName=true
        valid= false;
    }

  }
}
if(sameName==true)
    {
    $('#sameNameError').html('2 Passengers Cannot Have Same Name');
    }
else
    {
    $('#sameNameError').html('');
    }

```
You can add a verification javascript function , but first u need to have specific names for all input boxes . 
U can try something like this : 

```
<input type="text" name="adultFirstName1" id="adultFirstName1" class="form-control input-sm" placeholder="" style="width:100%; padding:5px;" OnClick="Verify();">
.
.
.
<input type="text" name="adultFirstName10" id="adultFirstName10" class="form-control input-sm" placeholder="" style="width:100%; padding:5px;" OnClick="Verify(id);">

```

then you'll need to verify at every change of value of a boxe .