Skip to content

Instantly share code, notes, and snippets.

Created February 3, 2015 21:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/11c28240c23f24be6bd5 to your computer and use it in GitHub Desktop.
Save anonymous/11c28240c23f24be6bd5 to your computer and use it in GitHub Desktop.
slim can't catch an options array well formed by html (+twig) named sel [ ].
// insert
$app->post('/insvei1',function () use ($app) {
include_once('includes/menu.php');
$id = $app->request()->post('idvei');
$sel = $app->request()->post('sel[]');
$conn = new MongoClient('mongodb://localhost');
$db = $conn->tasks;
$collection = $db->manupcars;
$document = array(
"idcar" => new MongoId($id),
"idman" => new MongoId($sel)
);
$collection->insert($document);
$link = $app->urlFor('mpclist');
$app->redirect($link);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment