I'm using Laravel 5. How do I use the $_GET variables inside my controller? This is my HTML;
<form class="form-horizontal" role="form" method="GET" action="http://127.0.0.1:8080/contracts/refine">
<div class="form-group">
<label class="col-md-4 control-label">Postcodes:</label>
<div class="col-md-6">
<select name="postcode_dataset_id">
<option value="1">February 2015</option>
<option value="2">May 2015</option>
<option value="3">August 2015</option>
</select>
</div>
</div>
<div class="form-group">
<div class="col-md-6 col-md-offset-4">
<button type="submit" class="btn btn-primary" style="margin-right: 15px;">Load</button>
</div>
</div>
</form>
When I submit the form it's going to my route.php;
Route::get('/contracts/refine', ['as' => 'postcodes-dataset-refine', 'uses' => 'ContractsController@refine']);
Now I want the result of the form in my Controller method so I can actually use it! So far I have this in my refine method in my controller;
public function refine()
{
print $_GET['postcodes_dataset_id'];
}
But I keep getting this error and I don't know what it means
ErrorException in ContractsController.php line 44:
Undefined index: postcodes_dataset_id
I tried to define it by going;
public function refine()
{
$postcodes_dataset_id = "";
print $_GET['postcodes_dataset_id'];
}
But that does nothing!
UPDATE - This is the top of my controller.. just to show you what namespaces I already have registered;
<?php namespace App\Http\Controllers;
use App\Http\Requests;
use App\Http\Controllers\Controller;
use App\Models\Contract;
use App\Models\PostcodeLookup;
use App\Models\Location;
use App\Models\Lookup;
//use Illuminate\Database\Schema\MySqlBuilder;
use Illuminate\Http\Request;
class ContractsController extends Controller {