/    Sign up×
Community /Pin to ProfileBookmark

Select multiple group individual Arrays

I have a problem, my [B]select multiple[/B] don’t shown separately the results on [B]arrays[/B] for each [B]group[/B].

The list would be left with check data from a select multiple preexisting file by $ _POST, and groups also. ?

[code=php]<?php

$arrYourArray = array(
“0” => “Elije para el grupo 1”,
“1” => “Elije para el grupo 2”,
“2” =>”Elije para el grupo 3″);
print_r($arrYourArray);
?>

<form name=”formu” id=”formu” action=”war.php” method=”post” enctype=”multipart/form-data”>

<dt><label>Accesorios opcional</label></dt>
<input type=”file” multiple id=”arc” name=”archivos[]” /><br />
<?php

for($i = 0; $i < 3; $i++) {

echo ‘<select name=”‘.$i.'” multiple>’;

echo ‘<optgroup name=”‘.$arrYourArray[$i].'” label=”‘ . $arrYourArray[$i] . ‘”>’;

foreach ($_FILES[‘archivos’][‘name’] as $value) {
$select = ‘<option name=”‘.$arrYourArray[$i].'” value=”‘ . $value . ‘”>’ . $value . ‘</option>’; //close your tags!!
echo $select;

}
echo ‘</optgroup>’;

echo ‘</select>’;

}

?>

<label>Prendas opcional</label>

<input type=”submit” value=”Enviar” id=”envia” name=”envia” />

</form>

<?php

for($i = 0; $i < 3; $i++) {
echo(“<pre>”);
print_r($_POST[$i]);
echo(“<pre>”);
}

echo(“<pre>”);
print_r($_POST[0]);
echo(“<pre>”);

echo(“<pre>”);
print_r($_POST[1]);
echo(“<pre>”);

?>[/code]

to post a comment
PHP

1 Comments(s)

×

Success!

Help @ApolexNet spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.2,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,
)...