\app\code\local\Svi\Form\controllers\IndexController.php
<?php
Class Svi_Form_IndexController extends Mage_Core_Controller_Front_Action{
public function indexAction(){
$layout =$this->loadLayout();
$this->renderLayout();
}
public function postAction()
{
$data = $this->getRequest()->getPost();
$model = Mage::getModel('form/form')->setData($data);
try {
$insertId = $model->save()->getId();
echo "Data successfully inserted. Insert ID: ".$insertId;
}
catch (Exception $e){
echo $e->getMessage();
}
}
}
?>
From $model, I found following array......
Svi_Form_Model_Form Object ( [_eventPrefix:protected] => core_abstract [_eventObject:protected] => object [_resourceName:protected] => form/form [_resource:protected] => [_resourceCollectionName:protected] => form/form_collection [_cacheTag:protected] => [_dataSaveAllowed:protected] => 1 [_isObjectNew:protected] => [_data:protected] => Array ( [fname] => amit [lname] => kushwaha [mothername] => Sushma [fathername] => bholaNath [mobile] => 8858234949 ) [_hasDataChanges:protected] => 1 [_origData:protected] => [_idFieldName:protected] => [_isDeleted:protected] => [_oldFieldsMap:protected] => Array ( ) [_syncFieldsMap:protected] => Array ( ) )
I found my table blank but it gave me message 'successful inserted'. What to do? please help me...