Where are the form values?

Where are the form values?

estudiosestudios Posts: 52Questions: 0Answers: 0
edited August 2013 in General
Allan

I want to use the data typed in the Editor window to set field en another database. I mean, supones you are adding a new person in the table "A". When you accept you add the data in table "A" and at the same time I want to add "same" data in fields of the "B" table.
You suggest to use

if ( isset( $_POST['action'] ) && $_POST['action'] === 'create' ) {
// … insert new row into second table

}
but how can I do the "INSERT" using values in the form??

Thanks a lot

Replies

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    Hi,

    The data is in the `$_POST['data']` associative array, with the parameter names matching the `name` you gave for the Editor initialisation. So for example if you had:

    [code]
    {
    "label": "Browser name",
    "name": "browser"
    }
    [/code]

    In the Editor Javascript initialisation, you could do:

    [code]
    $_POST['data']['browser']
    [/code]

    to get the value in PHP. The values can then be using to do a regular SQL INSERT.

    Allan
This discussion has been closed.