Skip to main content
Topic solved
This topic has been marked as solved and requires no further attention.
Topic: how to insert in different table? (Read 1697 times) previous topic - next topic

how to insert in different table?

My problems with inserting and updating are not over yet!
in docs/add page, I made an afterAdd event in page Events as follow:

$table_data = array(
  "doc" => $modeldata['doc'],
    "doc_id" => $modeldata['doc_id'],
       "part_id" => $modeldata['part_id'],
    "company_id" => $modeldata['company_id']
  );
$db->insert("sales", $table_data);

it is working perfect except for $modeldata['doc_id']
Notice: Undefined index: doc_id in C:\xampp\htdocs\stock_3\app\controllers\DocsController.php on line 231
I try everything I know so far, I can't get print_r($_POST) data as it go true the controller and redirect...
What I know so far is that: 'doc_id' is the only column in 'sales' table that is not in 'docs' table
What I think is happening phprad is cutting doc_id from POST data due to some reasons ?
help please?


Re: how to insert in different table?

Reply #1
[solved]
I'm so stuck to phprad, that I forgot $_POST

$table_data = array(
  "doc" => $modeldata['doc'],
    "doc_id" => $_POST['doc_id'],
       "part_id" => $modeldata['part_id'],
    "company_id" => $modeldata['company_id']
  );
$db->insert("sales", $table_data);