code_legend
code_legend

Reputation: 3285

PHP Slim retrieve variables

Essentially I want that when a user type category/business for instance, it renders searchPage.php?crs_category=business

I tried doing it as follow, but the functions inside that page do not seem able to fetch the variable. When directly directly to searchPage.php?crs_category=business it is able to.

$app->get('/category/:name', function ($name) use($app){
  $app->render("searchPage.php", array('crs_category' => $name));
});

Any help would be greatly appreciated.

Note: I do not want to use htaccess to rewritte rules.

Upvotes: 0

Views: 39

Answers (1)

Jan
Jan

Reputation: 43169

Try (also check if this is surely a get request [rather than post]):

$app->get('/category/:name', function ($name) use($app) {
    $app->render("searchPage.php", array('crs_category' => $name));
});
$app->run();

Upvotes: 1

Related Questions