How do you add in the yii form the action for PHP_SELF, I am currently using this:
'action' => '/site/contact',
but I want to replace the action to call itself again. How do I do that?
How do you add in the yii form the action for PHP_SELF, I am currently using this:
'action' => '/site/contact',
but I want to replace the action to call itself again. How do I do that?
I actually have in my controller the rendering of the page:
public function actionContact()
{
$model = new ContactForm;
if(isset($_POST['ContactForm']))
{
$model->attributes = $_POST['ContactForm'];
$model->subject = 'Inquiry';
if($model->validate())
{
$mailer = new EmailSender();
$success = $mailer->send($model, 'email@mail.com');
$this->render('index3',array(
'contactModel' => $model,
'applyModel' => new ApplyForm,
));
}
else
{
$this->render('index',array(
'contactModel' => $model,
'applyModel' => new ApplyForm,
));
}
}
else
{
$this->render('index',array(
'contactModel' => $model,
'applyModel' => new ApplyForm, ));
}
}
So do I still need to add the action in my cActiveForm array values? And if I still need it, how do I put the PHP_SELF on it?
Yii 1
'action' => Yii::app()->request->url,
Yii 2
'action' => Yii::$app->request->url,