Support the ongoing development of Laravel.io →
posted 9 years ago
Forms
Last updated 2 years ago.
0

In your controller

   $user = new User;
   $user->name = 'value_from_form';
   $user->password= 'value_from_form';
   $user->checkbox= 'selected_value_from_form';
   $user->save();

And in blade add your select boxes with the values Form::checkbox('name', 'value');

Last updated 9 years ago.
0

I don't think I understand what you're doing here very well...

you're creating an object User and saving it but it's all hard coded in the controller.

The field

$user->checkbox= 'selected_value_from_form';

I understand, the question I'm asking is how do I show a select box in my view that retrieves data from a "SELECT * FROM access"

and create a SELECT box with fields from the Access table in the "Create new User View"

I don't know if I'm making myself clear...

0

In routes.php

Route::get('/', function(){

	$items = DB::table('Access')->get();
	return View::make('Your_View')->with('items',$items);
});

in your View

    @foreach($items as $item )
        {{ Form::label('the access level ', $item->access_level) }}
        {{ Form::checkbox('access', $item->id ) }}
    @endforeach    
Last updated 9 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

ezequiels ezequiels Joined 20 Jan 2015

Moderators

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

Your logo here?

Laravel.io

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

© 2024 Laravel.io - All rights reserved.