Quantcast
Channel: CodeIgniter Forums - All Forums
Viewing all articles
Browse latest Browse all 14114

Get data arguments

$
0
0
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.

Viewing all articles
Browse latest Browse all 14114


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>