I'm trying to display a query in a view. Each result I want to be a submit button that would submit his value when clicked.
In ListController I have this code:
public function index()
{
$tables = DB::table('tables')->select('name')->get();
return view('welcome', compact('tables'));
}
In welcome.blade.php I have:
<form action="" method="POST">
@foreach($tables as $data)
<input type="submit" name="tables[]" value="">
@endforeach
</form>
In routes web.php I have:
Route::get('/', 'ListController@index');
And I get this error:
"htmlspecialchars() expects parameter 1 to be string, object given (View:...welcome.blade.php)"
What am I doing wrong?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire