I have a sample code:
<?php
$id = JRequest::getVar('id');
$action = "index.php?option=com_test&id=".$id;
?>
<form action="<?php echo $action ?>" method="get">
<input type="text" name="id" value=""/>
<input type="submit" value="submit" name="submit" />
</form>
When I submit form is url is “index.php&id=...” => error can’t find component
How to fix it is result “index.php?option=com_test&id=...“
JROUTE what is it?
In your
forum action, you should use the functionality from JRoute (The Component Router) to correctly route your URL in the framework to the component.JRoute::_('index.php?option=com_test&id=".$id');.Why?
To avoid problems when a menu item is created via Menu Manager, your code will be incompatible (i.e. the error
no component can be foundwill be displayed).Incompatible? what on earth do you mean?
This would be because someone might of created a menu item
index.php/myMenuItem/which by joomla standards makes the default url?option=com_testincompatible.Credit (JRoute, 2011)
Implementation
Other Examples..
If you want to see how JRoute is implemented in other components a good place to look is in the views section on the administrator component
com_menus. In the directorycom_menus/views/items/tmpl/edit.php.