Hello All,
My first post :
I have a Cgridview to populate all the datas from my table ,also have an option to edit or delete the particular row.
Currently I am stuck with the edit section, I have written following codes,but no use.
My model:Updatejob.php
public function edit() {
$criteria = new CDbCriteria;
$criteria->search('id', 'Admin', true);
return new CActiveDataProvider('viewjob', array(
'sort'=>array(
'defaultOrder'=>'key_skills ASC',
),
));
}
Controlller:
public function actionUpdateJob()
{
// This is were I am loading the id //
if(isset($_GET['id']))
{
$id=$_GET['id'];
}
$model = new UpdateJob('edit');
$params = array('model' => $model,'id' => $id
);
$this->render('update', $params);
// print_r($_POST); exit();
}
View: I am just posting demo code since it is huge:
//I want to show the corresponding row data in the edit form.
<div class="row">
<?php echo $form->labelEx($model,'Company Name'); ?>
<?php echo $form->textField($model,'posted_by'); ?>
<?php echo $form->error($model,'posted_by'); ?>
</div>
Am I doing correct,or…if not then how should I do it.?
Pls Help