1

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() 

1 Answer 1

6

Use Input::get() instead of Input::post()

The keyword get in Input facade is not bound to $_GET but it's the name of the getter method.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.