countries icon indicating copy to clipboard operation
countries copied to clipboard

How to populate list of countries unto the drop down select list in blade.

Open Zikikizi opened this issue 5 years ago • 5 comments

Hi.

Am am actually new to php and laravel, but I am already working on a personal project. I need help with populating the countries list unto my registration select form, it comes totally blank. but when i dd($countries ) countries from controllers, it shows me the full list of countries, but the data is not passed unto the blade. My select list gets populated when i source data from a column in my database.

code to get list of all countries, it works when i die and dump $countries->all()->pluck('name.common')

blade code to display view, i also attached the @Artem-Schander @amenk @ralbear @Omranic @olimortimer

  • <select name="origin" id="origin" class="form-control" required>                            
    
  •     <option value="" selected disabled hidden>--Country of origin--</option>
    
  •         @foreach ($countries as $key => $value)
    
  •             <option value="{{ $value }}">{{ $value }}</option>
    
  •         @endforeach
    
  • </select>
    

I only want to make use of list of continents, list of sub-continents, list of countries, list of states, list of cities and maybe their other names. But I do not need currencies, flags, population, taxes, timezones etc.

i do intend to use the knowledge to also populate cities and states. I know its a novice question, but please help out its urgent, i have been stuck here for days. could not get help on the web.

Thank you very very much for your help

Zikikizi avatar Jul 28 '19 03:07 Zikikizi

help

Zikikizi avatar Jul 28 '19 03:07 Zikikizi

There should be some kinda magic or good luck here, just after I requested for help here, the very first attempt i made actually solved the problem. Wow!

Thank you all for your intended help.

Zikikizi avatar Jul 28 '19 03:07 Zikikizi

@Zikikizi can you please let me know how you resolved it? i am also stuck in it and if you can demonstrate it, i will really appreciate it. i know it's been a while you posted the question but your help would be really appreciated.

Naveedali1234 avatar Jan 20 '20 09:01 Naveedali1234

Hello bro, I actually opted to use geo data as it contains more data, exactly what I needed. However, I remember I was able to solve the issue, I will check my project and get back to you.

On Mon, 20 Jan 2020, 11:12 a.m. Naveed Ali, [email protected] wrote:

@Zikikizi https://github.com/Zikikizi can you please let me know how you resolved it? i am also stuck in it and if you can demonstrate it, i will really appreciate it. i know it's been a while you posted the question but your help would be really appreciated.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/antonioribeiro/countries/issues/121?email_source=notifications&email_token=AMXG2HCFGVKM6BB5MDF7TNDQ6VTJNA5CNFSM4IHLQTRKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEJL4T3Y#issuecomment-576178671, or unsubscribe https://github.com/notifications/unsubscribe-auth/AMXG2HHWLHJAS4SV4LDCUFTQ6VTJNANCNFSM4IHLQTRA .

Zikikizi avatar Jan 20 '20 22:01 Zikikizi

You can mail me [email protected]

On Tue, 21 Jan 2020, 12:26 a.m. Bene Bene, [email protected] wrote:

Hello bro, I actually opted to use geo data as it contains more data, exactly what I needed. However, I remember I was able to solve the issue, I will check my project and get back to you.

On Mon, 20 Jan 2020, 11:12 a.m. Naveed Ali, [email protected] wrote:

@Zikikizi https://github.com/Zikikizi can you please let me know how you resolved it? i am also stuck in it and if you can demonstrate it, i will really appreciate it. i know it's been a while you posted the question but your help would be really appreciated.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/antonioribeiro/countries/issues/121?email_source=notifications&email_token=AMXG2HCFGVKM6BB5MDF7TNDQ6VTJNA5CNFSM4IHLQTRKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEJL4T3Y#issuecomment-576178671, or unsubscribe https://github.com/notifications/unsubscribe-auth/AMXG2HHWLHJAS4SV4LDCUFTQ6VTJNANCNFSM4IHLQTRA .

Zikikizi avatar Jan 20 '20 22:01 Zikikizi