Forums

Call the single arrays values

vismay 22 Mar, 2013
Hello,

in a form I have the following array:
[recipient] => Array
        (
            [1] => Array
                (
                    [name] => uytuyt
                    [cognome] => uytuy87
                    [gg_ospite] => 68
                    [mm_ospite] => 87
                    [yyyy_ospite] => 6876
                    [cittadinanza_ospite] => 
                    [residenza_ospite] => AG
                    [residenza_ospite_comune] => yutuotyt
                )

            [2] => Array
                (
                    [name] => uytuyt
                    [cognome] => uytuy
                    [gg_ospite] => 78
                    [mm_ospite] => 87
                    [yyyy_ospite] => 8768
                    [cittadinanza_ospite] => 
                    [residenza_ospite] => AG
                    [residenza_ospite_comune] => uytuyotu
                )

        )


These are made by this function:

<input type='text' name='recipient[{$i}][name]' id='recipient_{$i}_name' />

and so on.
Now I would like to do a final page where the customer can check their entry, and I have to call for each recipient the arrays created.

I've tried somethig like {recipient[{$i}][name]}, but of course it doesn't work....

Coudl someone help me?
vismay 23 Mar, 2013
I have the feeling that probably I'm not able to write questions...
Anyone has an idea how to solve it?

Matteo
GreyHead 23 Mar, 2013
Hi Vismay,

Nothing personal, I've just been busy :-( :-)

Please try something like this:
>?php
foreach ( $form->data['recipient'] as $k => $v ) {
  echo "<h4>Recipient {$k}</h4>";
  echo "<div>Name: {$v['name']}<br />
    Cognome: {$v['cognome']}<br />
    . . .
    Residenza Ospite Comune: {$v['residenza_ospite_comune']}</div>";
}
?>

Bob
vismay 23 Mar, 2013
et voila'!!!!!

Thanks!!!!1 it works!!!!!

YOu are great!!!

Matteo
This topic is locked and no more replies can be posted.