Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

laravel form post issue

I am building a practice app with the Laravel framework I built a form in one of the views which is set to post to the same view itself but when I hit submit the form is posted however I do not get the desired output, I see the original view again.

Here is my view index.blade.php

@extends('master')

@section('container')

<div class="wrapper">

    {{ Form::open(array('url' => '/', 'method' => 'post')) }}
        {{ Form::text('url') }}
        {{ Form::text('valid') }}
        {{ Form::submit('shorten') }}
    {{ Form::close() }}

</div><!-- /wrapper -->

@stop 

and my routes.php

Route::get('/', function()
{
return View::make('index'); 
});

Route::post('/', function() 
{
return 'successfull';
});

What I've tried so far

  • I tried changing the post to a different view and it worked. However I want the form to post to the same view itself.

  • Instead of returning a string I tried to return make a view still it didn't work.

What am I doing wrong?

addendum

I see that when the form is making the post request I am getting a 301 MOVED PERMANENTLY HEADER

like image 885
Ragzor Avatar asked Jul 07 '13 11:07

Ragzor


1 Answers

{{ Form::open(array('url' => ' ', 'method' => 'post')) }}

Passing a space as the url has worked for me.

like image 128
Raul Avatar answered Sep 29 '22 08:09

Raul