Magento 1 – Redirect Form Action to Controller (404 Error on Form Submit)

actioncontrollersformsmodule

I'm new to Magento.
Need to create an extension which will enable to add comments to products on 'product view' pages.
I created a new tab next to "descriptions" and "reviews" and added the form, but can't put the correct form action which will load the controller file, save the input information and then save it in the database.
Read lot of different articles,but couldn't figure this out.
Any help is greatly appreciated!

This is the form action line in app\design\frontend\rwd\default\template\productcomments\productcomments.phtml

<form enctype="multipart/form-data" method="post" action="<?php echo $this->getUrl('productcomments/index/savecomment'); ?>" id="product-view-add-comment">

Here is my indexController.php content:

class Cpstest_ProductComments_IndexController extends Mage_Core_Controller_Front_Action
{
    public function savecommentAction()
    {
        echo "Hello";
    }
}

And I added the block information (tab "Product Comments") in app\design\frontend\rwd\default\layout\catalog.xml
like this:

<block type="catalog/product_view_attributes" name="product.comments" as="additional" template="productcomments/productcomments.phtml">
    <action method="setTitle" translate="value"><value>Product Comments</value></action>
</block>

Best Answer

<module>Cpatest_ProductComments</module>

I am making some assumptions, but it seems like this should instead be Cpstest_ProductComments. Now that you have added the file paths, it looks like your controller filename is incorrect. It should be: controllers\IndexController.php (note the plural controllers).