[Solved] How To Get An Array In A Form Submitted

Hi everybody ! :)

I have my eventForm model. In this model I have some array.

declared like this :


public $DateEvent  = array();

so In my view, I have a loop depending of the number of day where the user have to fill several Date :




for($i=1;$i<=intval($nbJours);$i++)

{

...

<div class="row">

	<?php echo $form->labelEx($eventForm,"DateEvent"); ?>

	<?php echo $form->textField($eventForm,"DateEvent[$i]"); ?>

	<?php echo $form->error($eventForm,"DateEvent[$i]"); ?>

</div>

...



then when I submit the form I want to get back my array to store it in the DB. to check if I have all my data, I do a toString function. And, I have all my data which aren’t in an array :


public function toString($eventForm)

{

	$s = $eventForm->Titre; //ok

	$s = $s.' Nb Jours : '.$eventForm->nbJours; //ok 

		

	for($i=1;$i<=$eventForm->nbJours;$i++)

	{

		$s = $s.' JOUR ';

		$s = $s.'Date event : '.$eventForm->DateEvent[$i]; //nothing

		$s = $s.'nbSess : '.$eventForm->nbSession[$i]; // nothing 


                 ...


	}

	$s=$s.' FIN_JOUR '; 

		

	return $s;

}

Any idea? I read some thing about tabular form, but it didn’t solve it…

thx in advance.

— Edit :

I edited in my post the mistake.

what was wrong :

1st : problem of count. (array start at cell 1 and not 0 as expected.

2nd : problem of rules. No rules was describe for some of my counter, (not even array(‘var, var2’,‘Safe’) so it wasn’t attribute correctly.

3rd : "DateEvent[$i]" instead of "[$i]DateEvent"

thx anyway for reading.