@illfamed move return 123 to the top of the method (before validation). Maybe your validation failed?
Check network tab of browser dev tool to see the actual response
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hi there,
I'm trying to pass form data to a controller function and I believe I'm either doing something wrong with the form action or with the routing. Below are three images of my form, routes and controller function. ( I can't post link yet since I've just created this account on this forum, so please replace (dot) with a .)
i(dot)imgur(dot)com/1iuI889.png
i(dot)imgur(dot)com/JmaUH84.png
i(dot)imgur(dot)com/hoTPrpC.png
This is a single page application for people to register for an event. I'm trying to save the form data into a mysql database, but when I submit the form, the data doesn't reach the controller since it doesn't return "123". Any help would be greatly appreciated.
EDIT: This is what my code looks like now
<form method="POST" action="{{ route('registreer.store') }}" class="regForm"> @csrf ...
Route::get('/', [RegistreersController::class, 'index']); Route::post('/', [RegistreersController::class, 'store'])->name('registreer.store');
public function store(Request $request) { return 123; }
EDIT #2: I fixed the issue by changing
<form method="POST" action="action="{{ route('registreer.store') ... >
to
<form method="POST" url="action="{{ route('registreer.store') ... >
So I had to change action= to url=
@illfamed this is not a solution, you just changed it so that the form does not have an action since url is not a valid attribute for forms
I think your problem is a little seen issue with laravel and posting to ''/"
It will probably work with
Route::post('/store', [RegistreersController::class, 'store'])->name('registreer.store');
<form method="POST" action="{{ route('registreer.store') }}" ... > @csrf
Please or to participate in this conversation.