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
indexview file in yourPOSTroute?shorten.dev/? I think you see my point - your form being set to submit to/, which should be going toshorten.dev/and not tolocalhost:8888/since your code is not "listening" atlocalhost:8888/.