In this article, see a practical example of using the sc\_confirm macro.

![](//img.zohostatic.com/zde/static/images/info.png)This macro can only be used on PHP buttons created in the toolbar of **form** and control applications, with the aim of confirming the action's excursion.

See how to create a PHP field to update your application's records, thus replacing the tool's update button.

## **Creating a PHP button**

1. Click on the option **New Button.**

![](https://desk.zoho.com/DocsDisplay?zgId=716875472&mode=inline&blockId=o91uu4a52811591724600af4b7eec3efa39d3)

2. Select the PHP type and enter a name.

![](https://desk.zoho.com/DocsDisplay?zgId=716875472&mode=inline&blockId=o91uu0d3db83c995645d8917659e9fbd77bb9)

3. Configure the look of your button

![](https://desk.zoho.com/DocsDisplay?zgId=716875472&mode=inline&blockId=o91uu817b3d2ee0a24c99ac5cf69c10989a9c)

## **Using the sc\_confirm macro**

In the PHP button event, created in the previous session, add the lines of code below

![](//img.zohostatic.com/zde/static/images/exclamation.png)

The code below serves as the basis for your use. They must be appropriate to the reality of your system.

1. // Update the name according to the key field of the table
2. $ UPDATE = "UPDATE clients SET name = '" . {Name} . "'WHERE id =" . {id};
3. sc\_exec\_sql ($ UPDATE);

1. // Confirms whether you really want to update therecord
2. sc\_confirm("Do you really want to update the record?");

1. // Updates the page
2. sc\_redir (form\_sample\_sc\_confirm);

## sc\_confirm macro in operation

When executing the form, change the name and click the button Save Record.

A confirmation message will appear, like the one below.

![](https://desk.zoho.com/DocsDisplay?zgId=716875472&mode=inline&blockId=o91uuf1ac2cb6ad1b44aba761a932ae1af8c8)

### Clicking Cancel

The action will not be performed.

That is, no event command will be executed.

### When you click OK

The action will be performed.

That is, the update command will be executed and the name will be changed in the database.