Dynamic Dropdown PHP not reading array

DrSmith69 26 Aug, 2019
Hi all,

I am having difficulties loading my php array into my dropdown.

My API call is returning the correct array in what I assume is the correct format - this is from my debugger where i have added a
$this->data('first_place',$allTeams,true); command to return the below array - my php function is called php3

[first_place] => Array
        (
            [0] => Arsenal
            [1] => Aston Villa
            [2] => Chelsea
            [3] => Everton
            [4] => Liverpool
            [5] => Man City
            [6] => Man United
            [7] => Newcastle
            [8] => Norwich
            [9] => Tottenham
            [10] => Wolverhampton
            [11] => Burnley
            [12] => Leicester City
            [13] => Southampton
            [14] => Watford
            [15] => Crystal Palace
            [16] => Sheffield Utd
            [17] => Brighton Hove
            [18] => West Ham
            [19] => Bournemouth
        )

In my dropdown options I have tried {var:php3} and {var:first_place} and none of them populate my dropdown. I have placed the php in front of my display_section as well.

What am I missing?
DrSmith69 26 Aug, 2019
Answer
got it working, changed {var:first_place} to {data:first_place} working beautifully!
healyhatman 27 Aug, 2019
You really shouldn't be adding it to a data value like that. You should just return the array from your PHP block, and use {var:phpblockname} instead of using $this->data('name', $value, true)
This topic is locked and no more replies can be posted.