Can't access value from the form

view: test.php

<form enctype="multipart/form-data" id="file-form" action="/hznsvn/trunk/hzn/index-test.php/about/aboutus" method="post">

                     &lt;input name=&quot;is_image&quot; value=&quot;1&quot; id=&quot;is_image&quot; type=&quot;hidden&quot; /&gt;                       &lt;input id=&quot;ytFile_pic_name&quot; type=&quot;hidden&quot; value=&quot;&quot; name=&quot;File[pic_name]&quot; /&gt;&lt;input name=&quot;File[pic_name]&quot; id=&quot;File_pic_name&quot; type=&quot;file&quot; /&gt;                      


                     &lt;input class=&quot;save_btn&quot; style=&quot;margin-left:40px&quot; type=&quot;submit&quot; name=&quot;yt0&quot; value=&quot;上传形象照&quot; /&gt;                         


              


                  &lt;/form&gt;

controller :

echo $this->getPost(‘is_image’); // [color="#FF8C00"]why i can’t access the value ‘1’ from the test.php[/color]

$this->render(‘test’);

note: here is the definination of getpost ,as the following,

public function getPost($name, $defaultValue=null){

    return Yii::app()-&gt;getRequest()-&gt;getPost(&#036;name,&#036;defaultValue);


}

any help be appreciated!!!

Did you submit the form? If you do, it should work because before submit the $_POST array is empty. And here is the getPost function. its returning null in your case because you probably didn’t submit it.




public function getPost($name,$defaultValue=null)

        {

                return isset($_POST[$name]) ? $_POST[$name] : $defaultValue;

        }