Newbie to Laravel, trying to make a form that uses POST to send a single parameter. I want to query a DB table for last names using the first name I input in the form.
I think I narrowed down the error to either my route:
Route::post('get_last', function() { $query= 'SELECT last FROM "names" WHERE first =?'; $bindings= array(Input::post('first_name')); $last_name = Name::selectOne($query, $bindings); Redirect::route('last_name', array('last_name' => $last_name)); }); The redirect is a page that is supposed to show the results, I tested that one manually and it seems to work. I believe the error could also be something in the 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 this is the exception I get when I run it:
Symfony \ Component \ Debug \ Exception \ FatalErrorException (E_ERROR) Call to undefined method Illuminate\Http\Request::post()