In my app, error 404 shows on create and update after clicking the save button. When I look at my database, it works and inserted successfully. What seems wrong? Please help.
Here is the code for my controller:
public function actionCreate()
{
$model=new Contractor;
// Uncomment the following line if AJAX validation is needed
// $this->performAjaxValidation($model);
if(isset($_POST['Contractor']))
{
$model->attributes=$_POST['Contractor'];
if($model->save())
$this->redirect(array('view','id'=>$model->name));
}
$this->render('create',array(
'model'=>$model,
));
}
/**
* Updates a particular model.
* If update is successful, the browser will be redirected to the 'view' page.
* @param integer $id the ID of the model to be updated
*/
public function actionUpdate($id)
{
$model=$this->loadModel($id);
// Uncomment the following line if AJAX validation is needed
// $this->performAjaxValidation($model);
if(isset($_POST['Contractor']))
{
$model->attributes=$_POST['Contractor'];
if($model->save())
$this->redirect(array('view','id'=>$model->name));
}
$this->render('update',array(
'model'=>$model,
));
}