Support the ongoing development of →
Input Forms Laravel
Last updated 1 year ago.

Hello Ilhm,

Next time try to place the code in a code block, then it is more readable :)

The error is indeed that the $countries variable doesn't exist. You should give it to the view on the place where you create the view.


public function create()
	// an example, I suspect you can load it from the database or a config file
	$countriesList = [
	return view('contact.create')
		->with('countries', $countriesList) // this is the place where you create a $countries variable in your view with the content of $countriesList. They can have the same name but to make the example clear I use 2 different names.

You can also do

return view('contact.create', ['countries' => $countriesList]);

See the documentation:


Sign in to participate in this thread!


Your banner here too?

Ilham ilhm Joined 28 Oct 2019


We'd like to thank these amazing companies for supporting us

Your logo here?

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 - All rights reserved.