CMS tutorial issue for a newbe

Hello, I just started to learn PHP/CakePHP. I’m a Systems Engineer so, I’m very familiar with coding, but in my old days the languages were others: VB, COBOL, Pascal, etc. So, moving into a WEB development is a challenge and something I really want to learn. Installed CakePHP 5.1.6 and started to follow the CMS tutorial. Got to the point of adding tags to the articles. So, very weird that EDIT function in ArticlesController work just fine, but the ADD funcion give me a warning message : “Undefined Variable $tags”. Bot functions have the same sintax, but only the ADD function has the error…I’m hiting my head on the wall, not sure where else to look.

Agregar Articulo

<?php echo $this->Form->create($article); // Hard code the user for now. echo $this->Form->control('user_id', ['type' => 'hidden', 'value' => 1]); echo $this->Form->control('title'); echo $this->Form->control('body', ['rows' => '3']); echo $this->Form->control('tags._ids', ['options' => $tags]); echo $this->Form->button(__('Guardar Articulo')); echo $this->Form->end();

Edit Article

<?php echo $this->Form->create($article); echo $this->Form->control('user_id', ['type' => 'hidden']); echo $this->Form->control('title'); echo $this->Form->control('body',['rows' => '3']); echo $this->Form->control('tags._ids',['options' => $tags]); echo $this->Form->button(__('Guardar Articulo')); echo $this->Form->end();

I just found the issue. The $tags = was inside of an IF statement on the ADD function and after on the EDIT function. Just moved out and all is fine now…thanx