I have a model called Person.php and a model called Country.php. Then I have the view Persons/create.php
I included the model of the countries and I called $modelCountry but is it not working. I got the error:
Undefined variable: modelCountry
This is the model/Persons.php file.
<?php
use yii\helpers\ArrayHelper;
use yii\helpers\Html;
use yii\widgets\ActiveForm;
/* @var $this yii\web\View */
/* @var $model app\models\Person */
/* @var $modelCountry app\models\Country */
?>
<div class="person-create">
<?php $form = ActiveForm::begin(); ?>
<?= $form->field($model, 'phone')->textInput() ?>
<?= $form->field($modelCountry, 'name')->textInput() ?>
<?= Html::submitButton($model->isNewRecord ? 'Create') ?>
<?php ActiveForm::end(); ?>
</div>
Then I want to use the send button to send both models to the controller (controllers/PersonsController.php)