# protected/models/RequestForm.php !extension_loaded('gd'), 'captchaAction' => 'site/captcha') ); } public function attributeLabels() { return array( 'organization'=>'Организация', 'name'=>'Контактное лицо', 'email'=>'Email', 'telefon'=>'Телефон', 'text'=>'Текст заявки', 'verifyCode'=>'Введите символы с картинки', ); } public function action() { $reqForm = new RequestForm; if(isset($_POST['RequestForm'])) { $reqForm->attributes = $_POST['RequestForm']; $reqForm->organiztion = $_POST['RequestForm']['organiztion']; $reqForm->name = $_POST['RequestForm']['name']; $reqForm->email = $_POST['RequestForm']['email']; $reqForm->telefon = $_POST['RequestForm']['telefon']; $reqForm->text = $_POST['RequestForm']['text']; $email = Yii::app()->email; $email->to = 'МЫЛО'; $email->subject = 'Заявка'; $email->message = 'Организация: ' . $reqForm->organization . ' Контактное лицо: ' . $reqForm->name . ' Email: ' . $reqForm->email . ' Телефон: ' . $reqForm->telefon . ' Текст заявки: ' . ' ' . $reqForm->text; $email->send(); if($model->validate()) $this->redirect(Yii::app()->user->returnUrl); } $this->redirect('/submitted'); } } # protected/views/layouts/column2.php
beginWidget('CActiveForm', array( 'enableAjaxValidation'=>true, 'id'=>'RequestForm', )); ?> errorSummary($reqform); ?>
label($reqform,'organization', array('class'=>'formlabel',)); ?> textField($reqform,'organization') ?>
label($reqform,'name', array('class'=>'formlabel',)); ?> textField($reqform,'name') ?>
label($reqform,'email', array('class'=>'formlabel',)); ?> textField($reqform,'email') ?>
label($reqform,'telefon', array('class'=>'formlabel',)); ?> textField($reqform,'telefon') ?>
label($reqform,'text', array('class'=>'formlabel')); ?> textArea($reqform,'text', array('class'=>'area_type1')) ?>
labelEx($reqform, 'verifyCode', array('class'=>'formlabel'));?>
widget('CCaptcha', array('captchaAction' => 'site/captcha'));?> textField($reqform, 'verifyCode');?>
error($reqform, 'verifyCode');?>
endWidget(); ?>