Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php //pjax::begin(['enablePushState' => false]); ?>
- <div id="contact-form">
- <?php $form = ActiveForm::begin(['action'=>'/quick-contact/create','id'=>'quick-contact','method'=>'post']); ?>
- <?= $form->field($model, 'name')->textInput(['maxlength' => true]) ?>
- <?= $form->field($model, 'email')->textInput(['maxlength' => true]) ?>
- <?= $form->field($model, 'message')->textarea(['rows' => 2]) ?>
- <div class="form-group">
- <?= Html::submitButton(Yii::t('app', 'Save'), ['class' => 'btn btn-success']) ?>
- </div>
- <?php ActiveForm::end(); ?>
- </div>
- <div id="quick-contact-form">
- <?php if (Yii::$app->session->hasFlash('success')): ?>
- <div class="alert alert-success alert-dismissable">
- <button aria-hidden="true" data-dismiss="alert" class="close" type="button">×</button>
- <h4><i class="icon fa fa-check"></i>Saved!</h4>
- <?= Yii::$app->session->getFlash('success') ?>
- </div>
- <?php endif; ?>
- // display error message
- <?php if (Yii::$app->session->hasFlash('error')): ?>
- <div class="alert alert-danger alert-dismissable">
- <button aria-hidden="true" data-dismiss="alert" class="close" type="button">×</button>
- <h4><i class="icon fa fa-check"></i>Saved!</h4>
- <?= Yii::$app->session->getFlash('error') ?>
- </div>
- <?php endif; ?>
- </div></div>
- <?php // pjax::end(); ?>
- public function actionCreate()
- {
- $model = new QuickContact();
- if (Yii::$app->request->isAjax) {
- Yii::$app->response->format = yiiwebResponse::FORMAT_JSON;
- var_dump($_POST);
- if ($model->load(Yii::$app->requset->post()) && $model->save()) {
- Yii::$app->session->setFlash('success','Thanks We will get in touch with you');
- // $st = Yii::$app->getTable;
- // $email_template = $st->email_template(1);
- Yii::$app->mailer->compose()
- ->setTo('info@mywebsolutions.co.in')
- ->setFrom(['info@mywebsolutions.co.in'])
- ->setSubject('QuickContact')
- ->setHtmlBody('Request from - '.$model->name.'<br>'.'Email - '.$model->email. '<br>'.'Message - '.$model->message)
- ->send();
- /* Yii::$app->mailer->compose('template', ['id' => 1, 'email_template' => $email_template, 'sender_name'=>$model->name,'message'=>$model->address])
- ->setTo($this->email)
- ->setFrom([$email => "vedic"])
- ->setSubject($this->subject)
- //->setHtmlBody('Hi '.$this->name.'<br>'.'Welcome to Nexgen'.'<br>'.'We confirm of having received your Enquiry/feedback as below'.'<br>'.$this->body )
- ->send();
- */
- }else{
- Yii::$app->session->setFlash('error','There was an error in submission.');
- }
- //return $this->render('/site/index');
- }
- // return $this->renderPartial('/site/index');
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement