How to use the forms in Laravel 4.2

Hi guys! Today I want to speak again about Laravel and in this tutorial I will explain to you how you can create new forms in Laravel.

So, to create a new form, open your view file(example: index.php) and add this code:

{{ Form::open(array('url' => 'foo/bar')) }}

{{ Form::close() }}

This code will create a new form. If it doesn't work, rename your view file, from nameofyourfile.php to nameofyourfile.blade.php.

Next you can add label:

{{ Form::label('email', 'E-Mail Address') }}

Text input:

{{ Form::text('username') }}

Password:

{{ Form::password('password') }}

File input:

{{ Form::file($name, $attributes = array()) }}

Radio input:

{{ Form::radio('name', 'value') }}

Checkbox input:

{{ Form::checkbox('name', 'value') }}

Button:

{{ Form::submit('Click Me!') }}

Video tutorials:

You can find the Laravel's forms documention at http://laravel.com/docs/4.2/html









Leave a Comment