$client->setClientCity($info['city']); $client->setClientEmail($info['email']); $client->setClientName($info['name']); $client->setClientPostal($info['postal']); $client->setClientTelephone($info['phone']); $client->setCompany($info['company']); $client_id = $client->addClient(); $worksheet->setClient($client_id); } else { // its set as false, take saved id $worksheet->setClient($_POST['worksheet']['client']); } // set data $worksheet->setCRM($_POST['worksheet']['CRMNumber']); $worksheet->setCRMDate($_POST['worksheet']['CRMDate']); $worksheet->setDate($_POST['worksheet']['date']); $worksheet->setExpenses($_POST['worksheet']['expenses']); $worksheet->setMaterial($_POST['worksheet']['material']); $worksheet->setNotes($_POST['worksheet']['notes']); $worksheet->setSignatureClient($_POST['worksheet']['signature']); $worksheet->setSignatureUser(1); $worksheet->setStopwatch($_POST['worksheet']['stopwatch']); $worksheet->setUser($_POST['worksheet']['user']); $worksheet->addWorksheet(); //var_dump($_POST); /** * array(1) { ["worksheet"]=> array(6) { ["worksheetstatus"]=> string(1) "1"