Question:
I have a View
where customer data is shown, and when clicking a button, the user is redirected to a page that shows the movements of several customers, so this page contains some filters. So what I need is that when this client clicks on the button and is redirected to the page with the filters, the items referring to it are filtered.
For example:
<center><strong>--Simulando--</strong></center><br>
<i>Ao clicar no botão, da `View`, abrirá a página `Nfse`, pertencente à outra controller.</i>
<hr>
<br><br>
<strong><i>VIEW:</i></strong> <br><br>
<table border='1'>
<tr>
<th>Cliente</th>
<th>Cnpj</th>
<th>Nfes emitidas</th>
</tr>
<tr>
<td>XX SERVICOS</td>
<td>00000000000100</td>
<td><center><button>Nfes</button></center></td>
</tr>
</table>
<br><br>
<i> Ao clicar no botão <button>Nfes</button> será redirecionado para ...</i>
<br><br>
<strong><i>Nfes:</i></strong><br><br>
<input type='text' placeholder='nr.nfe'>
<input type='text' placeholder='cnpj emitente' value='00000000000100'> <small><small>#Este campo deverá vir preenchido#</small></small>
<input type='text' placeholder='dt emissao'>
<input type='button' value='Filtrar'>
<br><br>
<i>Trazendo como resultado esses dados simulados!</i>
<br><br>
<table border='1'>
<tr>
<th>Nr.nfe</th>
<th>cnpj emitente</th>
<th>dt emissao</th>
</tr>
<tr>
<td>11324</td>
<td>00000000000100</td>
<td>31/01/2017</td>
</tr>
<tr>
<td>11323</td>
<td>00000000000100</td>
<td>28/01/2017</td>
</tr>
<tr>
<td>11322</td>
<td>00000000000100</td>
<td>15/01/2017</td>
</tr>
</table>
When dealing with two different controller
, I'm not able to find a solution for this, could you collaborate with any idea or correction?
Answer:
As I understand it, you don't know the helpers. They facilitate the code implementation, and do everything for you, passing php data and assembling the html structure with that data. Sorry if I misinterpreted.
If you haven't tried, you can make a link redirecting to the other controller's view, passing some parameters referring to the client that should be filtered.
$html->link(/* o botão */,
['controller' => /* o controller */,
'view' => /* a view */,
$parametro1,
$parametro2]);
The controller and the view is where you want to redirect the client and if you have more parameters, just put more, separated by commas. Remembering that the parameters are available in your controller's function. I put it in a generic way because I don't know exactly how its structure is I hope I helped.