0
votes

I have working on some Component in Joomla 2.5 ( it means I'm trying to write a component in joomla :) ).

My situation is :

I have create the back-end UI which have a table to show some data from database .

My Question is :

How do I get the data which posted by selecting the rows to do some thing on the table.

Details :

My MVC works Find and i routed program after clicking the button to my Model but I don't know how to get the data from that form.

Any help would be appreciated.

2
Are you asking how to get the data from the checkboxes? - Elin
Exactly , I want to know that . - user1438910
If your back-end is rather standard, I strongly suggest working with JTable and having a look at com_banners for example. It's a high probability that what you need is already there in Joomla!, just you have to follow some patterns. Also posting some code where you are stuck will help us help you. - Valentin Despa

2 Answers

0
votes

Thanks Elin, but the answer which I found after spending some time analyzing other components was:

  1. You should get the data which posted by previous page by this command:

    $jApp = JFactory::getApplication();
    
  2. It is a Array which you should look for specific key "cid" in it by this code:

    $ids  = JRequest::getVar('cid', array(), '', 'array');
    
  3. You have the id of that rows in an array, now you can do something like this:

    foreach ($ids as $i => $id)
    {
      $query = $db->getQuery(true);
      $db->setQuery($query);
      //some code
      $db->query(); // to do change in DB
      $results += $db->getAffectedRows();
    }