1. Go to this page and download the library: Download wdmg/yii2-forms library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
wdmg / yii2-forms example snippets
use yii\widgets\ActiveForm;
...
$form = ActiveForm::begin();
ActiveForm::end();
$form = ActiveForm::begin();
ActiveForm::end();
if (!is_null($result = Yii::$app->forms->submit('feedback-form', $data))) {
if ($result === true) {
Yii::$app->session->setFlash('success', 'Your Feedback form successfully submitted!');
} else {
Yii::$app->session->setFlash('danger', 'An error occurred while sending the Feedback form.');
}
}