Welcome Guest, Not a member yet? Register   Sign In
Get data arguments
#1

Hi, today I tried to follow the manual, in order to get data from the form, and did not quite understand how to correctly pass the parameter.

In my controller:
PHP Code:
$model->setParam([
 
'firstParam' => $this->request->getVar('firstParam'),
 
'secondParam' => $this->request->getVar('secondParam')
]); 

When I send 2 arguments in my model:
PHP Code:
public function setParam($firstParam$secondParam) {
 return $this->table('test')->protect(false)->insert([
 
 'title' => $firstParam,
 
 'text'  => $secondParam
 
]);

Get "Too few arguments to function ParamModel:ConfusedetParam(), 1 passed in Controllers/Param.php on line 457 and exactly 2 expected".

When I send 1 argument in my model, get "operand should contain 1 column(s)"... 
PHP Code:
public function setParam($firstParam) {
 return $this->table('test')->protect(false)->insert([
 
 'title' => $firstParam,
 
 'text'  => '$secondParam'
 
]);


Looking inside print_r($firstParam); getting Array ( [firstParam] => 67545647f [secondParam] => 654547547554d )

Tell me please what I missed. Thanks.
Reply


Messages In This Thread
Get data arguments - by Nome - 06-08-2018, 03:54 AM
RE: Get data arguments - by ciadmin - 06-08-2018, 08:48 AM
RE: Get data arguments - by Nome - 06-09-2018, 03:43 AM
RE: Get data arguments - by InsiteFX - 06-09-2018, 09:08 AM
RE: Get data arguments - by Nome - 06-20-2018, 02:28 AM



Theme © iAndrew 2016 - Forum software by © MyBB