Get rowID from List view and pass to List PHP plugin

ritesh123

Member
Hi All

I have a list view and records are like this

ID Area Check
1 Area1 Check1
2 Area2 Check2
3 Area3 Check3

I want a button when clicked it should run a PHP script with its row ID

PHP Script is having a variable with row ID

Please let me know, if this can be done.Can we supply the ID from List view to PHP Script
 
Can you post your solution, for the benefit of anyone else searching on how to do this?

I presume the issue was that $ids will be an array, which you'll need to turn into a string before trying to use it in a string context.

Also, I would strongly suggest you sanitize your input, and make sure it's only numbers. Passing a form input straight to shell_exec without sanity checking is a security nightmare - someone could pass shell commands in with the ids.

-- hugh
 
Here is the solution

$app = JFactory::getApplication();
$ids = $app->input->get('ids', array(), 'array');

foreach ($ids AS $myid)
{
$row = $model->getRow($myid);
$primarykey = $row->tablename___id;
$area = $row->your-full-elementname;
$check = $row->your-full-elementname;


$servicename=$area.$primarykey.$check;


shell_exec("NET START $servicename");
}
 
We are in need of some funding.
More details.

Thank you.

Members online

No members online now.
Back
Top