I have a form with this entry
<input type="checkbox" name="option[repassage]" id="options1" value="10.00"> Repassage 30 mn
<input type="checkbox" name="option[frigo]" id="options2" value="5.00"> Frigo 30 mn
With php i do this to get all the options and i put them in an array but i can not get the right values for 'titre_option' and 'prix_option' !!!
if (isset($_POST['option'])) {
foreach ( $_POST['option'] as $key => $value ) {
$_SESSION['option'][] = array('titre_option' => $_POST['option'][$key], 'prix_option' => $_POST['option'][$value]);
}
}
// What i get
Array
(
[0] => Array
(
[titre_option] => 10.00
[prix_option] =>
)
[1] => Array
(
[titre_option] => 5.00
[prix_option] =>
)
)
// What i need
Array
(
[0] => Array
(
[titre_option] => repassage
[prix_option] => 10.00
)
[1] => Array
(
[titre_option] => frigo
[prix_option] => 5.00
)
)
Thank you for your help...
Aucun commentaire:
Enregistrer un commentaire