infos.blade.php
@extends('template')
@section('contenu')
{{ Form::open(array('url' => 'users')) }}
{{ Form::label('nom', 'Entrez votre nom : ') }}
{{ Form::text('nom') }}
{{ Form::submit('Envoyer !') }}
{{ Form::close() }}
@stop
this is template.blade.php
<!doctype html>
<html lang="fr">
<head>
<meta charset="UTF-8">
<body>
@yield('contenu')
</body>
</html>
Thank you, that's working .
Can you explain what is the problem in the previous code ?
If you provide an array with url
parameter to Form::open()
, the action attribute of <form> tag gets exactly that URL. So if your site URL is http://mysite.com/ and you do:
{{ Form::open(array('url' => 'users')) }}
You get action="http://mysite.com/users". This is not what you wanted. 'users' of your controller route is just a prefix, which means that all routes made by this controller are going to start with /users/.
When you skip the url
parameter of Form::open(), it's pointing to itself by default. And that works for you, because you have the same URL for GET and POST methods and that's /infos.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community