I generated a project using the yiic tool from the command line. Then I used gii to create a model and its accompanying crud operations. This table previously data. I navigated to the manage link and from the display gridview I clicked update on one record. The page loaded with error 400 your request is invalid.
My operating system is fedora 16.
my server is apache server 2.2.22
am using php 5.4.1.1
am using yii framework 1.1.10
This is the code sample
public function actionUpdate($id)
{
$model=$this->loadModel($id);
// Uncomment the following line if AJAX validation is needed
// $this->performAjaxValidation($model);
if(isset($_POST['Admission']))
{
$model->attributes=$_POST['Admission'];
if($model->save())
$this->redirect(array('view','id'=>$model->pk_serial));
}
$this->render('update',array(
'model'=>$model,
));
}
If i pass a default parameter value the error disappears and my code picks the default value as opposed to the value on the url
Example
public function actionUpdate($id='')
{
$model=$this->loadModel($id);
// Uncomment the following line if AJAX validation is needed
// $this->performAjaxValidation($model);
if(isset($_POST['Admission']))
{
$model->attributes=$_POST['Admission'];
if($model->save())
$this->redirect(array('view','id'=>$model->pk_serial));
}
$this->render('update',array(
'model'=>$model,
));
}
But if on the same action i use the $_GET[‘id’] function it will return the url value.
Example:
public function actionUpdate($id='')
{
$id_test = $_GET['id'];
$model=$this->loadModel($id);
// Uncomment the following line if AJAX validation is needed
// $this->performAjaxValidation($model);
if(isset($_POST['Admission']))
{
$model->attributes=$_POST['Admission'];
if($model->save())
$this->redirect(array('view','id'=>$model->pk_serial));
}
$this->render('update',array(
'model'=>$model,
));
}
i have the same problem(as the first member) when i click the update thumbnail button(or any other: delete, view)not in my regular buttons, in my CRUD application
Just in case anyone comes across this issue. In my case, the issue was with the php_apc.dll extension. Once it was disabled, reflection worked properly.