Wednesday, 15 April 2015

php - Simple POST form error in Laravel -



php - Simple POST form error in Laravel -

newbie laravel, trying create form uses post send single parameter. want query db table lastly names using first name input in form.

i think narrowed downwards error either route:

route::post('get_last', function() { $query= 'select lastly "names" first =?'; $bindings= array(input::post('first_name')); $last_name = name::selectone($query, $bindings); redirect::route('last_name', array('last_name' => $last_name)); });

the redirect page supposed show results, tested 1 manually , seems work. believe error in blade file though:

@extends('layout') @section('content') {{ form::open(array('url' => 'get_last', 'method' => 'post')) }} {{ form::text('first_name', 'first name') }} {{ form::submit('search') }} {{ form::close() }} @stop

for reference exception when run it:

symfony \ component \ debug \ exception \ fatalerrorexception (e_error) phone call undefined method illuminate\http\request::post()

use input::get() instead of input::post()

the keyword in input facade not bound $_get it's name of getter method.

php laravel blade

No comments:

Post a Comment