Get Element Data in PHP plugin

Status
Not open for further replies.

waby

Member
Hi,

I try to add a button in a list using the PHP plugin to redirect the user to another form. To do that I need to pass the ID (rowid) data into the URL.

I put this code in PHP Code :

$id = 12;
$url = 'index.php?option=com_fabrik&view=list&listid=58&Itemid=783&lang=en&parent_id=';
header("Location: http://$url$id");
exit();

How can I replace the "12" with the ID (rowid) data as it has been done with the edit, view buttons ?

The placeholder doesn't work.

Thanks in advance

Regards,

Eloise
 
{rowid} Gives you the primary id

$url = 'index.php?option=com_fabrik&view=list&listid=58&Itemid=783&lang=en&parent_id={rowid};
 
I didnt realise it didn't work there.

$db =& JFactory::getDBO();
$ids = JRequest::getVar('ids', array());

echo '<pre>'; print_r($value); echo '</pre>'; exit;


First two lines should get you the ID then.... third line for you to debug.
 
You should say so then. :)

I don't know your PHP knowledge so I don't know if I providing enough information....then on the other hand I may not understanding what you are doing... ;)

I put this code in PHP Code :

$id = 12;

So I am assuming $id is your way of hardcoding it to test?

You want the rowid for the PHP button?

So the full code you could do something like this.
Code:
<?php

$db =& JFactory::getDBO();
$id_array = JRequest::getVar('ids', array());
$id = reset($id_array);
$url = 'index.php?option=com_fabrik&view=list&listid=58&Itemid=783&lang=en&parent_id=';
header("Location: http://$url$id");
 
Status
Not open for further replies.
We are in need of some funding.
More details.

Thank you.

Members online

No members online now.
Back
Top