PHP code example of dolphiq / craft3-forms

1. Go to this page and download the library: Download dolphiq/craft3-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/ */

    

dolphiq / craft3-forms example snippets


        namespace app\forms;
                 
        use Craft;
        use plugins\dolphiq\form\models\Form;
        
        class contactForm extends Form {
        
         public $firstname = "";
         public $lastname = "";
         public $phone = "";
         public $email = "";
         public $message = "";
        
         public function rules()
         {
             return [
                 [['firstname', 'lastname', 'email', 'message'], ''Message'),
             ];
         }
        }
        

        
  
        /**
          * @var $model app\forms\contactForm
          * @var $handle string
          */
    
        use yii\widgets\ActiveForm;
        use yii\widgets\Pjax;
        
        // Start ajax handling of the form
        Pjax::begin(['enablePushState' => false, 'id' => 'pjax-'.$handle]);
  
        // Start active form
        $form = ActiveForm::begin([
            'action' => \craft\helpers\UrlHelper::actionUrl('dolphiq-craft3-forms/main/index', ['handle' => $handle]),
            'method' => 'POST',
            'options' => [
                'data-pjax' => true,
            ],
        ]);
  
        

   
   /**
     * @var $model \app\forms\contactForm
     */
   

    
    
    use yii\widgets\DetailView;
    
    /* @var $this \yii\web\View view component instance */
    /* @var $message \yii\mail\BaseMessage instance of newly created mail message */
    /* @var $model \app\forms\contactForm */
    
    

    
        
    /* @var $this \yii\web\View view component instance */
    /* @var $message \yii\mail\BaseMessage instance of newly created mail message */
    /* @var $model app\forms\contactForm */
    
    
html
forms/
    contact/
        contactForm.php
        contactView.php
    vacancy/
        vacancyForm.php
        vacancyView.php
        vacancyMailOwner.php
        vacancyCustomerMail.php
        vacancyThanks.php
    thanks.php