Support the ongoing development of Laravel.io →
Input Views Forms

Hi, I have form:

<form action="{{ url('users') }}" method="POST">
<table>
<tr><td><label for="login">user:</label></td><td><input type="text" name="login" value=""></td></tr>
<tr><td><label for="password">password:</label></td><td><input type="password" name ="password"></td></tr>
<tr><td><label for="email">email:</label></td><td><input type="text" name ="email"></td></tr>
<tr><td colspan="2"><input type="submit" value="add"></td></tr>
</table>
{{Form::token()}}
</form>

and one route:

Route::controller('/users','UsersController');

if form validation is failed shows a message and I would like to forward the data form in views like this:

public function postIndex(){
$data = Input::all();
//walidacja formularza
return View::make('users/create')->with('user',$data)->withErrors($validator);
}

{{ isset ($user) ? $user['login']:''}}

how to do it differently? (with using controller route-> Route::controller('/users','UsersController'); )

Thanks for your help ;)

Last updated 3 years ago.
0

First of all I'd recommend you to use Blade templating for the form Laravel docs

If I understand you correctly, you want this:

{{ $errors->first('login') }}

Or if you want to style it inside a tag, pass in a second parameter as this:

{{ $errors->first('login', '<span class="error">:message</span>') }}

It should be placed inside the form

And perhaps it would be better to return

    return Redirect::back()->withInput()->withErrors($validator);
Last updated 3 years ago.
0

Sign in to participate in this thread!

PHPverse

Your banner here too?

mgebala8 mgebala8 Joined 6 Jul 2014

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.

© 2025 Laravel.io - All rights reserved.