Hi
You can't do that
First, if your PHP Element array change for each line of Multiline Option, the php code has to be in the loop, before Dropdown
Second: to pass a var from php to CF7, you have to use this syntax:
$this->set("var_cf7", $varPhp);
So, in Dropdown Multine Line Options, you have to do that:
{var:var_cf7}
Third: CF7 array has to be an associative array.
For example, someone like this in PHP:
$carsPhp=array(0=>'Volvo',1=>'BMW',2=>'Saab');
$this->set("cars_cf7", $);carsPhp;
Then, in CF7, Multiline Options
{var:cars_cf7}
In this case, you have a dropdown, to choose between Volvo, BMW, Saab.
But I don't understand very well that you will.
May be...
first loop:choose between Volvo, BMW, Saab
Second loop; choose between Fiat,Mercedes, Porsche
Third loop: choose between Ferrari, Lamborghini, Porsche
Is it? In this case, you have to pass the row number to php to calculate between each row of the loop.
Good luck!
Sure, if you include this php element in the Repeater....
You have to include the php element in the repeater only if you will change the array for each loop to recalculate each time.
Want do you want exactly? In your picture, I don't see the source of the repeater.
Hi
First, can you speak french?
Two: I think you don't have to use a repeater. I see 2 methods.
1 More easy, using 2 dropdowns
You read the table to build an array of (Photo_id=>liste_id) to load in a first dropdown.
When the visitor choose a photo, you know the liste_id. Using Ajax, you load an array like (liste_id=>format_price_id) to load in a second dropdown.
Then the visitor can choose a Format/Price in the second dropdown.
2 using Relations table + special field to build an array of (photo/list=>format_price).
So you have a dropdown like:
photo1/liste:Format_price1
photo1/liste:Format_price2
photo1/liste:Format_price3
photo1/liste:Format_price4
photo2/liste:Format_price1
photo2/liste:Format_price2
photo2/liste:Format_price3
photo2/liste:Format_price4
...
In the second method, if you have many photos, your dropdown list will be very very large!
I don't analyse your job in detail, but I see at least one big bug:
Not {var:read_immagini.0.Foto.cf_id} : you are reading only the firt line!
but {var:read_immagini.[n].Foto.cf_id} to read all lines.
Yes Colnem, but, I should see only a element, 3277 only a time.
For ever element of repeater, this option increases by one.
first element = 1 (3277)
second = 2 (3277,3277)
then = 10 (3277, 3277,3277,3277,3277,3277,3277,....)
Ok I didn't't understand.
So it's more easy. And don't use a repeater.
You read your table xijdhd_cf_prodotti_formatti with Add Where conditions in SQL Statement: id_listino = {var:read_immagini.[0].Sottogalleria.id_listino}
Then, please, post me a copy of the result...
I'm waiting for you...
Sorry but if I can't use repeater, what I use?
A Read data Element to read your table xijdhd_cf_prodotti_formatti with Add Where conditions in SQL Statement: id_listino = {var:read_immagini.[0].Sottogalleria.id_listino}...
The result will be an array of value that you can use to read the second table.
The result of the second table will'be used to build your var for the dropdown.
I retake.
Table 1: Read Element with Add SQL STatement: cf_id = 3277 to read id_listino
Table 2: Second read Element table xijdhd_cf_prodotti_formatti with Add Where conditions in SQL Statement: id_listino = {var:read_immagini.[0].Sottogalleria.id_listino}
So your result will be only id=208....
If it's good, In the dropdown:
Option Value = {Prezzi.id} (for the moment).
Option Text = {Prezzi.prezzo} (for the moment).
I believe that you expect somenone like a list of Format+Prize:
prezzo1 / 2.00
prezzo / 5.00
02 / 2.00
01 / 1.00
Isn't it?
If I'am wright: Option Text = {Prezzi.formato} / {Prezzi.prezzo}
I've said "Read data read an array"? I'm wrong. Sorry for my bad english language.
I would say "Read Data return always results in associative array"
See up at your pictures: read_immagini)=>Array, (read_prezzi)=>Array...
Hi Colnem, I read some times yours post, but I don't understand.
You say that I must not use repeater.
But I need to get a loop of items (Photos), there is another way?
Thank you so much if you can help me!!!
Hi
First, you said you want a list of item in a dropdow box. To do that, you don't need a repeater.
But, may be, I've don't understand very well what you want...