<a href="www.mysite.com/index.php?information/adminpanel/<?php echo $id;?>" name="approve"
id="approve" ">Approve >></a>
When I am redirecting to this url it shows correct id in url but gives page not found error. I am new to cpanel. Please tell me is there any other way I can pass this id or how to route page in cpanel with uri segment.
Most probably you are missing a part in URL unless you have changed the routing in .htaccess
file somehow.
The right URL should most probably be (if you didn't change anything)
www.mysite.com/index.php?route=information/adminpanel&some_id=<?php echo $id ?>
Note that the controller/action
part should be sent as a part of query string under the variable route
and that the ID variable has to be a part of query string as well under you name it variable that is then obtained from $_GET['younameit']
in your controller.
The routing in OpenCart is done either via SEO URLs like
www.mysite.com/category-slug/sub-category-slug/product-slug
or even
www.mysite.com/product-slug
while these are being translated by mod_rewrite
rule into
www.mysite.com/index.php?_route_=<SEO_URL_PART>
or by non-SEO URLs where You need to specify the controller
www.mysite.com/index.php?route=common/home
where the default index()
action of CommonHomeController
is invoked or even by specifying the concrete action to be invoked as in
www.mysite.com/index.php?route=checkout/cart/add
where the add()
action of CheckoutCartController
is invoked. Because of this calling an URL like
www.mysite.com/index.php?route=information/adminpanel/123
would lead to trying to invoke the action 123()
within the InformationAdminpanelController
which most probably does not exist. Instead of this if you call URL
www.mysite.com/index.php?route=information/adminpanel&some_id=123
it will be the index()
action invoked while you can obtain the some_id
value like this:
if (!empty($this->request->get['some_id'])) {
$some_id = $this->request->get['some_id'];
} else {
$some_id = 0;
}
if ($some_id) {
// ...
}
Again - all described above is the default OpenCart routing behavior and will apply for your installation as well unless you have changed the mod_rewrite
rules defined in .htaccess
file.