See the chapter on routing, they would be passed as parameters rather than get request would be the only difference.
Similar to passing parameters to a function.
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I have an HTML form that submits a GET request. Below is the Blade template for it:
@extends('base')
@section('content')
@error('serial')
<div class="alert alert-danger">{{ $message }}</div>
@enderror
<div class="row">
<p>Type a part number into the box and press "Generate Report" (Example:
<a href="{{ route('weldtub.show', ['serial' => '90114-624']) }}"> 90114-624</a>).</p>
<p>Printing is optimized for the Chrome browser.
<a href="javascript:window.print()"><em class="fi-print"></em> Click here to print.</a></p>
<p>To print select tubs type desired page numbers under print preview (Example: 1-3 or 1,2,3)</p>
</div>
<div class="row">
<form action="{{ route('weldtub.show', ['serial']) }}" method="get">
<label for="serial">Serial Number:</label>
<input type="text" name="serial" value="{{ old('serial') or '' }}">
<input type="submit" value="Generate" class="button postfix">
@csrf
</form>
</div>
@endsection
The route definition is as follows:
Route::get('/fabrication/weldtub/{serial}', 'WeldTubsController@show')->name('weldtub.show');
When the form submits, I would like it to use this route instead of appending a query string the the URL. How can I do that? If this isn't the right way to make this work, please point me in the right direction.
When submitting a form you don't need a parameter there:
Route::get('/fabrication/weldtub', 'WeldTubsController@show')->name('weldtub.show');
Just request the data:
$serial = $request->serial;
Its a form there, not a link.
A link
<a href="<?php echo 'weldtub/' . $row->serial; ?>">Edit</a> // just example.
A link and a submitted form are not the same.
That should be a post form the way you are using it.
Please or to participate in this conversation.