Jump to content

passer un array multimensionnel dans un form


Recommended Posts

Bonjour à toutes

je dois passer un array de cette forme, via un form.

Array
(
    [21988_37062] => Array
        (
            [combination] => 42
            [id_product] => 212988
            [name] => Nom
            [stock] => 1
            [stock_value] => 82 €
        )

    [21988_37063] => Array
        (
            [combination] => 42 2/3
            [id_product] => 212988
            [name] => Nom2
            [onstore_sells] => 1
            [onstore_revenues] => 89.33 €
        )
    [21988_37261] => Array
        (
            [combination] => 43 2/3
            [id_product] => 212988
            [name] => Nom3
            [onsite_sells] => 3
            [onsite_revenues] => 340.33 €
        )
...
}

Ma "solution" a été de passer de multiples input de cette forme :

<input type="hidden" name="revenues_21988_37062_combination" id="revenues_21988_37062_combination" value="42">
<input type="hidden" name="revenues_21988_37062_id_product" id="revenues_21988_37062_id_product" value="212988">
<input type="hidden" name="revenues_21988_37062_name" id="revenues_21988_37062_name" value="Nom">
<input type="hidden" name="revenues_21988_stock" id="revenues_21988_stock" value="1">

Mais du coup, comment récupérer mes valeurs ?

ne connaissant ni les clés de premier niveau, ni celles de second niveau

 

boucler sur $_POST ?

 

une autre solution plus propre ?

Merci

Share this post


Link to post
Share on other sites

ben oui pourquoi ?

peut être parce que je n'y ai as pensé / n'en avais pas connaissance

 

j'etais parti sur du implode / explode interminable à cause des multidimensions.

 

Merci Jeckyl, ça va marcher beaucoup mieux maintenant.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More