$_POST, "Unknown index:" returned from Controller custom function

Greetings,

trying to use $_POST[{Some Index}] inside Controller custom function InsertItem. Function is called from admin.php|CGridVeiw|{SomeButton, with url to that InsertItem function}.

In fact isset($_POST[‘Item’]) if false? Why can any1 tell me?

As you will see from code, there is 2 CGridView on page, also I check page and there is "name" = Item[name] etc. Also I try with

<?php


$form = $this->beginWidget('CActiveForm', array(


            'id' => 'transfer-summary-form',


            'enableAjaxValidation' => false,


            'htmlOptions' => array('enctype' => 'multipart/form-data', 'method' => 'post'),


        ));


?>

but also without success.

link to code:

Best regards.

$_POST holds the data that are sent from the HTML form with the action POST… if you send the data in the URL that data is in the $_GET array…

To check the data you get try with


print_r($_POST);

print_r($_GET);

print_r ($_POST); gives array(0)

print_r ($_GET); gives array({some data}), this {some data} are of course from url, id and lang parameters. ".../insertItem?id=2&lang=en

I’m trying to use $_POST data inside insertItem custom controller function. But without success.

As I already mention I try to use form widget where form is define with ‘method’=‘post’.

I also try to set explicitly

‘htmlOptions’ => array(‘method’ => ‘post’), for cgridview or some of their columns.

Whatever I try I only have $_GET with some data, $_POST is always array(0).

That means you are not getting any POST data…

when you have a form with the method POST that data is sent only when clicking the classic SUBMIT button… if there is a button or link that executes an ajax call than you need to send the data you need in the ajax call the form setup is not used in this case…

Now I understand… Thank you.