> For the complete documentation index, see [llms.txt](https://docs.acpt.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.acpt.io/forms/examples-of-form-usage/edit-an-existing-cct-record.md).

# Edit an existing CCT record

This example shows how to build a front-end form that lets users update an existing record in a Custom Content Type (CCT) table.

## Prerequisites

* A CCT table (e.g. `movies`) with at least one column (e.g. `title`, `year`).
* A form with the **Fill Table (CCT)** action and the `movies` table selected.

## 1. Create the form

In **ACPT → Forms**, create a new form and set:

* **Action** → Fill Table (CCT)
* **Table to fill** → `movies`

Leave **Record** blank — you will supply the record ID at render time via the shortcode.

Open the form builder and drag in the columns you want to expose (`title`, `year`, etc.). Save the form and note the **Key** shown in the forms list (e.g. `e45b2639`).

<figure><img src="https://3235524095-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fiyf0tSKPgXiyoQ3zV3I6%2Fuploads%2Fgit-blob-2b54bda139cb5ccc6b4a18b88712c725cf39f4c7%2Fcct-form-fill-table.png?alt=media" alt="Form settings with Table record action"><figcaption><p>General settings for a Table record form, with the movies table and its columns selected.</p></figcaption></figure>

## 2. Render the form for a known record

Use the `record_id` shortcode attribute to pre-load record `49`:

```
[acpt_form id="e45b2639" record_id="49"]
```

The form renders pre-populated with the current column values of that record. On submission the record is updated in place.

In PHP you can build the shortcode dynamically — for example from a URL query parameter:

```php
$recordId = intval($_GET['record_id'] ?? 0);

if ($recordId > 0) {
    echo do_shortcode('[acpt_form id="e45b2639" record_id="' . $recordId . '"]');
}
```

{% hint style="info" %}
If `record_id` refers to a record that does not exist in the configured table, the shortcode renders an error message and no form is displayed.
{% endhint %}

## 3. Pin a record in the form settings

If you always want the form to edit the same record, set the **Record** dropdown in the form's general settings instead of using the shortcode attribute. The pinned record takes precedence over `record_id`.

## 4. Insert a new record

Omit `record_id` (and leave **Record** blank in the settings) to always insert:

```
[acpt_form id="e45b2639"]
```

Each submission creates a new row in the `movies` table.
