The Slim Framework support forum has moved to This Tender forum is no longer maintained or monitored.

getParam provides null

noob's Avatar


25 Aug, 2017 10:29 AM

I'm trying to create a basic route that inserts a new tupple in the DB. For now I got:

$app->post('/test/add', function (Request $request, Response $response) {
$DB = new Db(DBHost, DBName, DBUser, DBPassword);
$id = $request->getParam('id');
$stuff = $request->getParam('stuff');

But when I enter a Json object, such as { "id":"3" , "stuff":"30" }, I get that bote $id and $stuff are null, so for some reason the getParam didn't work. I went over the syntax and definitions multiple times but couldn't find the source for it. I would appreciate your help.

  1. Josh Lockhart closed this discussion on 12 Feb, 2021 07:37 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts


? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac