Bonjour,

Je suis bloquer sur une boucle for pour dupliquer un nombre défini via $_post.

Voici le code :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
for ($i=1; $i<$nbs; $i++) {
$shipping->skybillValue->productCode = $_POST['choix'];            
$shipping->skybillValue->shipDate = date('c');          
$shipping->skybillValue->shipHour = date('G');
$shipping->skybillValue->weight = $_POST['poids'.$i.''];
$shipping->skybillValue->service = '0';                 
$shipping->skybillValue->objectType = $_POST['march'];  
$shipping->skybillValue->bulkNumber = $nbs_f; 
}
Je ne vois pas comment défini un skybillValue1, skybillValue2, skybillValue3,...
j'ai essayer :
$shipping->skybillValue[$i]->service = '0';.
$shipping->skybillValue." ".$i->service = '0';.
mais rien ne marche.

le but étant de dupliquer pour ensuite ajouter dans la page traitement.php le nombre de doublon.

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
public function __construct()
    {
        //$this->esdValue = new EsdValue();
        $this->headerValue = new HeaderValue();
        $this->shipperValue = new ShipperValue();
        $this->customerValue = new CustomerValue();
        $this->recipientValue = new RecipientValue();
        $this->refValue = new refValue();
        $this->skybillValue = new SkybillValue();
        $this->skybillParamsValue = new SkybillParamsValue();
    }
Merci pour votre aide.