// echo '</pre>'; $invoice->status = 0; $invc_num = $invoice->Save(); foreach ($passengers as $_rm => $_room) { foreach ($_room as $_psgr) { $ps = new passenger(); $ps->name = $_psgr['name']; $ps->en_name = $_psgr['en_name']; $ps->family = $_psgr['family']; $ps->sex = $_psgr['gender']; $ps->age = $_psgr['age']; $ps->birthdate = $_psgr['birthyear'] . '/' . $_psgr['birthmonth'] . $_psgr['birthday']; $ps->invoice = $invc_num; $ps->room = $_rm; $ps->nationalcode = $_psgr['code_melli_pass']; $ps->save(); } } if ($invc_num) { // add invoice detail // echo '<pre>'; // print_r($_SESSION['invoice']); // echo '</pre>'; // exit; $tcntt = 1; foreach ($_SESSION['invoice']['id'] as $key => $detail) { $invcdtl = new InvoiceDetail(); $invcdtl->invoice = $invc_num; $invcdtl->room = $_SESSION['invoice']['id'][$key]; $invcdtl->amount = $_SESSION['invoice']['price'][$key]; $invcdtl->room_title = $_SESSION['invoice']['name'][$key];