i have booking search result array list users search form.
example : after search1 1 adult , 2 kids, users array :
array ( [0] => adult [1] => kid [2] => kid )
after second search : 2 adults , 1 kid :
array ( [0] => adult [1] => kid [2] => kid [3] => adult [4] => adult [5] => kid )
after third search : 1 adult, 1 kid , 1 senior
array ( [0] => adult [1] => kid [2] => kid [3] => adult [4] => adult [5] => kid [6] => adult [7] => kid [8] => senior )
i'm trying save users id special conditions (we take our example):
for first search, increment ids:
- adult (key0) new > id take pax1
- kid (key1) new > id take pax2
- kid (key2) new > id take pax3
result : pax1, pax2, pax3
for other searchs, increment logic :
search2:
- adult (key3) exists in users array (key0) > id take pax1
- adult (key4) new > id take pax4
- kid (key5) exists in users array (key1)> id take pax2
result : pax1, pax2, pax3,pax1, pax2, pax4
search3:
- adult (key6) exists in users array (key0) > id take pax1
- kid (key7) exists in users array (key1) > id take pax2
- senior (key8) new > id take pax5
result : pax1, pax2, pax3, pax1, pax2, pax4, pax1, pax2, pax5
hope it's clear :)
my code wich increment id ($nblistepaxin users array) :
$nblistepaxin = array_count_values($tablistepaxall); $i = 1; foreach ($tablistepaxall $listein) { if ($listein == "enfant") { if (in_array("enfant", $tablistepaxall)) { $idpax = $i; } else { $idpax = $i; } } else { if (in_array("adulte", $tablistepaxall)) { $idpax = $i; } else { $idpax = $i; } } echo "pax ".$idpax."<br>"; $i++; }
Comments
Post a Comment