We help IT Professionals succeed at work.
Get Started

Unable to populate select list with correct values from array.

tjyoung asked
Last Modified: 2016-08-04
I am obviously very challenged with objects/arrays and am having another issue that I've tried about a thousand combinations to make work but still not working.

My goal is to populate a select list from a table column. I get very close but just can't get the syntax right no matter what I try.

Doing a var_dump of the data I'm trying to extract the values from I get this (which is expected):
array(11) { [0]=> object(stdClass)#625 (2) { ["group"]=> string(13) "payment_types" ["values"]=> string(32) "["Monthly","Bi-weekly","Weekly"]" } [1]=> object(stdClass)#626 (2) { ["group"]=> string(11) "drive_types" ["values"]=> string(77) "["Front Wheel Drive","Rear Wheel Drive","All Wheel Drive","Four Wheel Drive"]" } [2]=> object(stdClass)#627 (2) { ["group"]=> string(10) "warranties" ["values"]=> string(95) "["Remainder of Factory Warranty","Has Extended Warranty","Warranty is Available","No Warranty"]" } [3]=> object(stdClass)#628 (2) { ["group"]=> string(5) "gears" ["values"]=> string(82) "["3 Speed","4 Speed","5 Speed","6 Speed","7 Speed","8 Speed","9 Speed","10 Speed"]" } [4]=> object(stdClass)#629 (2) { ["group"]=> string(10) "fuel_types" ["values"]=> string(168) "{"Gasoline Fuel":"Gas","Diesel Fuel":"Diesel","Hybrid Fuel":"Hybrid","Flex Fuel Capability":"Flex Fuel Capable","Electric Fuel":"Electric","Propane Fuel":"Natural Gas"}" } [5]=> object(stdClass)#630 (2) { ["group"]=> string(18) "transmission_types" ["values"]=> string(40) "["Automatic","Manual","TipTronic","CVT"]" } [6]=> object(stdClass)#631 (2) { ["group"]=> string(6) "extras" ["values"]=> string(78) "["4x4","AWD","Turbo","Convertible","Cabriolet","Quattro","TDI","Supercharged"]" } [7]=> object(stdClass)#632 (2) { ["group"]=> string(9) "condition" ["values"]=> string(35) "["Excellent","Good","Fair","As Is"]" } [8]=> object(stdClass)#633 (2) { ["group"]=> string(10) "truck_cabs" ["values"]=> string(271) "["Regular Cab","Extended Cab","Crew Cab","--- Ford Specific ---","Super Cab","SuperCrew","--- Dodge Specific ---","Quad Cab","Mega Cab","--- Mazda Specific ---","Cab Plus","--- Nissan Specific ---","King Cab","--- Toyota Specific ---","Access Cab","Double Cab","CrewMax"]" } [9]=> object(stdClass)#634 (2) { ["group"]=> string(21) "vehicle_option_groups" ["values"]=> string(81) "["Comfort","Convenience","Entertainment","Safety","Exterior","Truck, Van & Jeep"]" } [10]=> object(stdClass)#635 (2) { ["group"]=> string(10) "passengers" ["values"]=> string(52) "["1","2","3","4","5","6","7","8","9","10","11","12"]" } } 

Open in new window

The particular select list I'm trying to populate is for 'Passenger Capacity' which is the last in the dump.

When I do the following in an effort to populate my select list I get this as a result:

sample pic of select list
To get it to populate like the sample pic, the code I'm using is:
@foreach ($configuration as $passengers)
<option  value="{{ $passengers->values }}" > {{ $passengers->values }}</option>

Open in new window

Can you see what I should be doing to drill down to the passanger capacity values and input them into the select?

Thanks as always. I very much appreciate the help.
Watch Question
Web Programmer/Technician
This problem has been solved!
Unlock 1 Answer and 8 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE