将数组作为选项的值传递给表单

I'm currently trying to send an array as the value of an option in a select but I cannot access the data after the form is sent.

echo '<select id="domainResults_domaines" name="domainResults_domaines">';
foreach($domainsFound as $domain){
    echo '<option value="'.$domain.'">'.$domain['domaine'].'</option>';
}
echo '</select>';

The $domain array contains 2 values and I want to be able to access both of those after sending the form. Is there a way to send the array as the value or is there another way to pass 2 variables in a single option?

Thanks for the help.

Try:

echo '<select id="domainResults_domaines" name="domainResults_domaines">';
foreach($domainsFound as $key=>$value){
    echo '<option value="'.$key.'">'.$value.'</option>';
}
echo '</select>';

Check out PHP foreach.

Value has to be string, you could use something like json_encode to set the value and json_decode to get the array back on server side.

foreach($domainsFound as $domain){
    echo '<option value="'.htmlspecialchars(json_encode($domain)).'">'.$domain['domaine'].'</option>';
}