I need to get the form values entered in the phtml file to my block file in order to perform insert operation to the database in my block. Is there any way to get the form values from the phtml file??
Asked
Active
Viewed 1,810 times
1 Answers
0
You should create new action in controller and submit the form on that action. you can refer the code below to save data in your controller.
public function postAction(){
$post = $this->getRequest()->getParams();
$model = Mage::getModel('example/example');
$data = $post['form field1'];
$model->setData($data);
$model->save();
Mage::getSingleton('core/session')->addSuccess('Successfully save data...');
$this->renderLayout();
}

Ram Sharma
- 8,676
- 7
- 43
- 56