Button on a grid row, execute a simple php function

Hello,

i created a link to every row of a grid. That is ok. But, it show as link, not as button. Why can i show the button?

With the button it should execute a simple php function (update one field in a record set). Must i link to a (blank) application, or can i execute a php function in the grid programming section?

Thanks.

Re: Button on a grid row, execute a simple php function

try to do something like this …

create a new field on the grid and execute this code on the onRecord event:
{new_field} = “<input type=“button” value=“teste” name=“teste” onclick=“window.location=’”. $_SERVER[‘PHP_SELF’] .”?code=". {FIELD_CODE} ."’;">",

this mean that you will re-open the grid passing the parameter code with the value of the field FIELD_CODE that you want to do something.

In the event onScriptInit you can check if the parameter is set and do what you want.

if($_GET[‘code’])
{
//do what you want
}

I didnt tested this example, i just write down to you. You can adapt to display a link, image, button … what you want. I just tryed to pass the idea.

Re: Button on a grid row, execute a simple php function

Hi Diogo,

perfect! Thank you!

hello you know I need to select some records from a grid and delete.

Only you have to delete the records that are selected as I can do that please help