Support the ongoing development of Laravel.io →
Requests Input
Last updated 2 years ago.
0

What is your infos view content?

0

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>
0

try php artisan routes

what is the output?

0

Call just:

Form::open()

without any parameters.

0

Thank you, that's working .

Can you explain what is the problem in the previous code ?

0

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.

0

That's clear , thank you.

0

Sign in to participate in this thread!

Eventy

Your banner here too?

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.