Hi, i have this code in my controller:
PHP Code:
$formData = \Config\Services::request()->getPost();
$this->email->setTo('[email protected]');
$this->email->setFrom($formData['email'], $formData['name'] . ' ' . $formData['surname']);
$myView = view('mail');
$this->email->setMessage($myView);
The code in my view 'mail':
Code:
<!DOCTYPE html>
<html>
<head>
<title>My mail view</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
<table>
<tbody>
<tr>
<td class="label">Nome Azienda:</td>
</tr>
<tr>
<td><?php echo $formData['nome_azienda'];?></td>
</tr>
<tr>
<td class="label">Nome:</td>
</tr>
<tr>
<td><?php echo $formData['name'];?></td>
</tr>
</tbody>
</table>
</body>
</html>
I have this error:
undefined variable $formData
How can is solve this issue and pass the variable to my view 'mail'?
Thanks for help me.
SOLVED.
I put
Code:
$formData = \Config\Services::request()->getPost();
in my view.