I am trying to insert textbox value into database on button click. Can u plz help me regarding the problem? I used this code to insert value in database table…
$data = array(‘title’=>’hello there’,’content’=>’how are you? i am fine over here.’,’status’=>1);
$model = Mage::getModel(‘mynews/mynews’)->setData($data);
try {
$insertId = $model->save()->getId();
echo “Data successfully inserted. Insert ID: “.$insertId;
} catch (Exception $e){
echo $e->getMessage();
}
but i want this on a button click. And it should take the values from textboxes.
Insert values of textboxes in to magento database
Share
For this you have to get the values from jQuery onlick with button id. And have to pass these values using the ajax.