0
votes

I have a submit button in my admin.php page.

echo CHtml::submitButton('Submit', array('onclick' => 'js:document.location.href="Save"'));

in my controller I have added this code-

public function actionSave()
{
    echo 'hi';
    echo var_dump($_POST);
}

Now the problem is it displays only 'hi' message but does dump any values of my page.

2
Because you have to submit form. Remove that JS and use submitButton - Valdas
Yes I have made changes but still does not dump values - user
Is your form method set to POST? try dumping $_REQUEST, maybe its passed over GET. - Valdas
Yea the form method is set to POST. If I replace it with $_REQUEST, it says that The system is unable to find the requested action "document.location.href="Save"". - user

2 Answers

0
votes
0
votes

$_POST is empty because you're not doing a POST request. To make a POST request you must create a form with a submit button.