Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class SiteController extends Controller
- {
- public function actionsearch()
- {
- $user_id = trim($_GET['id']);
- $model = new Job ;
- if(isset($_POST['Job']))
- {
- if(Yii::app()->getRequest()->getIsAjaxRequest())
- {
- echo CActiveForm::validate(array($jobProfileM2));
- Yii::app()->end();
- }
- $model->attributes=$_POST['Job'];
- if($model->validate())
- {
- $title=$_POST['Job']['title'];
- $experience=$_POST['Job']['experience'];
- echo "data".$experience=trim($experience);
- if($_POST['Job']['experience'] == " ")
- {
- echo "hai";
- }
- $model=Job::model()->findAll(array('select'=>'*',"condition"=>"(title like '%$title%')
- or (key_skills like '%$title%')",));
- $number=count($model);
- //$this->redirect($this->createUrl('site/search_result',array('title'=>$title,)));
- }
- else
- {
- Yii::app()->user->setFlash('error', "Validation failed!");
- }
- }
- $this->render('search',array('model' =>$model));
- }
- }
- ?>
- <div class="form">
- <?php $form=$this->beginWidget('CActiveForm', array(
- 'id'=>'login-form',
- 'enableClientValidation'=>false,
- 'htmlOptions' => array(),
- 'clientOptions'=>array(
- 'validateOnSubmit'=>true
- ),
- )); ?>
- <?php
- foreach(Yii::app()->user->getFlashes() as $key => $message) {
- echo '<div class="flash-' . $key . '">' . $message . "</div>n";
- }
- ?>
- <div class="row">
- <?php echo $form->labelEx($model,'Keyword'); ?>
- <?php echo $form->textField($model,'title'); ?>
- <?php echo $form->error($model,'Keyword'); ?>
- </div>
- <div class="row">
- <?php echo $form->labelEx($model,'Experience'); ?>
- <?php echo $form->textField($model,'experience'); ?>
- <?php echo $form->error($model,'experience'); ?>
- </div>
- <div class="row buttons">
- <?php echo CHtml::submitButton('Search'); ?>
- </div>
- <?php $this->endWidget(); ?>
- </div>
- if($_POST['Job']['experience'] == " ")
- {
- echo "hai";
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement