Array ( [result] => Data saved successfully! [dataset] => Array ( [option] => com_chronoforms7 [cont] => manager [chronoform] => ControlloCF [gpage] => end_page [IMP_CdFis] => 00000123456 [IP_RicCdFis] => MRYWLM80A01H501H [IP_RicDtSogg] => Mario Rossi [IP_RicDataN] => 17/05/2022 [__cf_token] => 250ed622-a766-483d-a4b3-39f09ac7c520 ) [log] => Array ( [0] => INSERT INTO `pratiche` (`IMP_CdFis`, `IP_RicCdFis`, `IP_RicDtSogg`, `IP_RicDataN`) values ('00000123456', 'MRYWLM80A01H501H', 'Mario Rossi', '17/05/2022'); ) [var] => Array ( [IMP_CdFis] => 00000123456 [IP_RicCdFis] => MRYWLM80A01H501H [IP_RicDtSogg] => Mario Rossi [IP_RicDataN] => 17/05/2022 [id] => 23 ) ) [php_27] => Array ( [returned] => NULL [var] => NULL ))I tried several ways but I cannot rertieve the "id" value in order to use it in a php action.Any suggestion?Thanks"> Retrieve ID of a saved database record - Forums

Forums

Retrieve ID of a saved database record

walterbz 17 May, 2022
Hi all.
I made a simple form that saves data in a db. It works perfectly.
I need to call a php file with the ID of the corrisponding saved record ID: load.php?id=XX
Using the debugger I've seen that the ID (23) of the saved record is conatined in the "save_data_20" array :
Array
(
    [save_data_20] => Array
        (
            [result] => Data saved successfully!
            [dataset] => Array
                (
                    [option] => com_chronoforms7
                    [cont] => manager
                    [chronoform] => ControlloCF
                    [gpage] => end_page
                    [IMP_CdFis] => 00000123456
                    [IP_RicCdFis] => MRYWLM80A01H501H
                    [IP_RicDtSogg] => Mario Rossi
                    [IP_RicDataN] => 17/05/2022
                    [__cf_token] => 250ed622-a766-483d-a4b3-39f09ac7c520
                )

            [log] => Array
                (
                    [0] => INSERT INTO `pratiche` (`IMP_CdFis`, `IP_RicCdFis`, `IP_RicDtSogg`, `IP_RicDataN`)  values  ('00000123456', 'MRYWLM80A01H501H', 'Mario Rossi', '17/05/2022');
                )

            [var] => Array
                (
                    [IMP_CdFis] => 00000123456
                    [IP_RicCdFis] => MRYWLM80A01H501H
                    [IP_RicDtSogg] => Mario Rossi
                    [IP_RicDataN] => 17/05/2022
                    [id] => 23
                )

        )

    [php_27] => Array
        (
            [returned] => NULL
            [var] => NULL
        )

)
I tried several ways but I cannot rertieve the "id" value in order to use it in a php action.
Any suggestion?
Thanks
walterbz 17 May, 2022
Answer
SOLVED
in php I used this:

$this->_vars['save_data_20']['id']
gilliancowe 18 May, 2022
Hi,

Would you mind telling me how you saved the data in the DB with your form, I'm having trouble figuring it out.

Many thanks,

Gillian
You need to login to be able to post a reply.