Form data not being passed through, coming back with 301 permanently moved error (using laravel) -
for whatever reason, returning 301 permanently moved error in inspector/network window. not posting form data table either.
index.blade.php file
{{ form::open(array('url' => '/')) }} {{ form::text('firstname' , '', array('placeholder' => 'first name'))}} {{ form::text('lastname' , '', array('placeholder' => 'last name'))}} {{ form::submit('add name', array('class' => 'btn btn-success'))}} {{ form::close() }}
route file
<?php route::get('/', function(){ return view::make('index'); }); route::post('/', function() { $input = input::all(); db::insert('insert donkey (firstname, lastname) values (?, ?)', array($input['firstname'], $input['lastname'])); });
any ideas?
you doing wrong, use following instead:
$input = input::all(); db::table('donkey')->insert( array('firstname' => $input['firstname'], 'lastname' => $input['lastname']) );
Comments
Post a Comment