I'm using Slim framework for my project. I've copied the Slim folder to my project directory.
No following is the code I'm having issue with :
HTML code (multiplemethods.html):
<html>
<head>
<title>Multiple Methods Routing Demo</title>
</head>
<body>
<form action="multiplemethodsroute.php/products" method="GET">
product id <input type="text" name="id" />
<br/>
<input type="submit" />
</form>
</body>
</html>
PHP Code(multiplemethodsroute.php):
<?php
require 'Slim/Slim.php';
/* Invoke the static "registerAutoloader()" function defined within Slim class.
* Register the autoloader is very important.
* Without doing it nothing will work.
*/
\Slim\Slim::registerAutoloader();
//Instantiate Slim class in order to get a reference for the object.
$application = new \Slim\Slim();
$application->map(
'products(/:id)',
function()
{
global $application;
$id = $application->request->get('id');
if($id == null)
{
$id = $application->request->post('id');
}
echo "showing info about product #".$id;
})->via('GET','POST');
$application->run();
?>
Both the files viz. multiplemethods.html and multiplemethodsroute.php are present in the same directory titled "slimsamples" at location /var/www/slimsamples
As I submit the HTML form by entering some number say 9565665 the 404 Page not found message appears on the browser window.
The control is not going inside the function written for map. I tested this during debug process.
Can someone please find out the mistake I'm making here?
Thanks in advance.